Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
 
 
Lab 3:  Math 121 
 
   
1.  
(Points: 2)    
  
Logic and truth tables have a lot to do with the building of electric circuits, which are used in 
all kinds of electronic devices. In this lab, we will see that circuits are essentially pictorial 
representations of the logical statements we studied in class. We will also explore in more 
depth how these ideas are related. 
Click here, then click "Open" on the dialog box that appears, for a java applet (written by 
David J. Eck of Hobart and William Smith Colleges) which we will use to build a logical circuit. 
Below is a quick tutorial on how to use this applet. 
1. On the left side of the screen you see the components that can be used to construct a 
circuit: NOT gate, OR gate, AND gate, input, and output (you can ignore the tack). In order 
to add one of these components, simply click on it and drag it to the center of the screen the 
"building area." Note that inputs and outputs must be placed around the outside of the 
building area. 
 2. If you want to move a component after you've already placed it, hold down the right 
mouse button and drag to where you want. To delete click on the component you want to 
delete, then click the Delete button at the bottom of the screen. 
3. In order to connect two components, click the purple"connector" of one and drag a "wire" 
to the green connector of the other. You must connect a purple connector to a green one; 
you cannot connect green to green, or purple to purple.  
 4. Your circuit can have as many inputs as you want, but it should have just one output. 
Every connector must be connected to something in order for your circuit to work.  
5. Once you are finished building your circuit, check the "Power" box at the bottom of the 
screen. You can now click on each of the inputs to turn them on (red) or off (black). 
Depending on what kind of circuit you have built, the output light will go on or off.  
 6. When you are finished, you can click the "Clear" button at the top of the screen to get rid 
of the circuit you have built, and make way for the next circuit. 
Following these instructions, build the circuit pictured above containing the AND gate. Call 
the top input P and the bottom input Q. There are four possible combinations of having the P 
and Q input on or off. Try all of these, and see which ones make the output light come on. 
We can represent this information in a table, which we will call an "On/Off chart." Select the 
On/Off chart representing the above circuit.  
 
 
a.  
P Q Output 
On On On 
On Off On 
Off On On 
Off Off Off 
 
b.  
P Q Output 
On On On 
On Off Off 
Off On Off 
Off Off Off 
 
c.  
P Q Output 
On On On 
On Off Off 
Off On On 
Off Off On 
 
d.  
P Q Output 
On On On 
On Off Off 
Off On Off 
Off Off On 
 
 
  Save Answer  
  
2.  
(Points: 2)    
  
Do you see how these circuits are connected to truth tables? When an input or output is On, 
we can think of this as its corresponding letter (P or Q) being "True." When it is Off, we can 
think of this as "False." So if in the On/Off charts from the previous question we replace each 
"On" with a "T" for true, and each "Off" with an "F" for false, and think of the Output column 
as the answer column, then we get truth tables. The reason the component we used is called 
an AND gate is because the Output column is the same as the answer column in the truth 
table for the logical connective (and). You can use this fact to double-check your answer 
to Question 1.  
Build the circuit pictured below, and make its On/Off chart (remember to let the top input be 
P, the bottom be Q). Then find the truth table for each statement below. Choose the 
statement which has the same truth table as the circuit (we can think of this circuit as 
"representing" this logical statement).  
  
 
a.  
b.  
c.  
d.  
 
  Save Answer  
  
3.  
(Points: 2)    
  
We can also do the opposite of what we did in the previous question, and build a circuit which 
represents a given statement. Build each circuit below, find each circuit's On/Off chart, and 
choose the circuit which represents the statement . Make sure to let the top input 
play the role of P, and the bottom input play the role of Q as before. Note this statement has 
truth table  
P Q 
 
T T T 
T F F 
F T T 
F F T 
so the correct circuit should have On/Off chart 
P Q Output 
On On On 
On Off Off 
Off On On 
Off Off On 
 
 
a. 
 b. 
 
c. 
 
d. 
 
 
  Save Answer  
  
4.  
(Points: 2)    
  
Up until now, all of our circuits have corresponded to logical statements in which the letters P 
and Q appear only one time. But there are times when one of these letters may appear more 
than once in a statement, for example in the statement . This can be easily 
handled by having more than one wire come off the P input -- for instance the circuit below 
represents the logical statement .  
 
 Using the methods we've used so far in the lab, choose the logical statement which 
represents the circuit pictured below (not the one above). 
 
 
 
a.  
b.  
c.  
d.  
 
  Save Answer  
  
5.  
(Points: 2)    
  
We can also make circuits with three inputs, which would correspond to logical statements 
containing three simple statements P, Q, and R. In this case we make the convention that 
the top input of the circuit is P, the middle is Q, and the bottom is R. Using all that we have 
done in this lab, match the circuit pictured with the logical statement below it represents. 
 
 
 
a.  
b.  
c.  
d.  
 
  Save Answer  
  
6.  
(Points: 5)    
  
We've seen that electrician is one profession in which an understanding of logic is necessary. 
Give another example of a job in which knowledge of logic is useful, and explain why. Some 
suggestions are lawyer, detective, politician, or computer programmer, but feel free to come 
up with your own ideas  
Paragraph   
Insert equation   
  Save Answer