In the table below, you'll see some decimal numbers in the left hand side. These are your targets. In the middle of the table, you see a row of black and red dots. These represent LED's. Red means binary 1. Black means binary 0. Go ahead and mash one of the dots. It changes state -- 0 becomes 1, 1 becomes 0. Notice that the rightmost number also changes. It is the decimal number corresponding to the binary number.
Your job is to set the binary bits so that the right column matches the left column, if possible, be prepared to explain your answers.
Now try out binary representations using 16 bits.
Ask your lab instructor to verify that you've pushed all the right buttons.
Check to make sure that this folder exists before continuing.
Start up JCreator by opening the Lab03 folder and double-clicking on the ".jcw" file (i.e., Lab03.jcw). Once the project is open in JCreator, you should be able to execute the program by selecting the Execute Project option under the Build Menu of JCreator's toolbar. Run the program giving it the input that it requests.
Now, look in the FileView window and notice that this is a project that contains more than one class. In the FileView window, select the file MyClass.java which will open that file in the edit window. Notice that this class consists of a single method called TestFunc(), and that the method contains only one statement which is a call to System.out's println() method. (The main() method for this program is in the TestLab03 class). Look at the argument to the println() method (i.e., the information inside the ()'s), and then compare it to the information that is printed when the program is run. Notice that println() prints the final value of the expression that it receives as its argument.
Your job is to modify the method TestFunc() to print the eight expressions listed in the following table. Notice that the first expression is already done for you.
|1||Average of y and z|
|2||Average of i and j|
|3||The reminder when i is divided by j|
2 y + 4 j z
2 3 -(y - z )
y + z ------- y - z
i -------- i + 1
i --------- i + 1.0
i --- * j j
After you have thoroughly tested your code, and you understand why the expressions print as they do, ask your instructor to test your code.
Write a program that prompts the user to enter 3 integer numbers and then prints their average, sum and product. You will need to close the Lab03 workspace and start a new project as described in Lab02. Do not use the MyClass.java from Lab03 as a model for your new program, instead use the program in Listing 2.13 of your text. The program in Listing 2.13 of your text uses the Keyboard class, and so will you if you want to make it easy to get the information that the user enters on the keyboard. You can download the Keyboard class from this link. Follow the instructions given in assignment 1 for adding the Keyboard class to your JCreator project.
After you have tested your code, ask your instructor to test it.