The goal of this lab is to practice writing, compiling, and testing Java programs.
Make a new directory, and copy the file Lab3.java
from the
course directory.
cp /homeemp/tvandrun/pub/235/Lab3.java .
This file gives you five of the algorithms problems we saw at the beginning of this class several weeks ago. We solved these algorithms before; now you must write them in Java and make working programs out of them.
Using if
and while
is new to you.
Look on the board to see how to form these correctly in Java.
There also are parts of the program given to you that you will not yet understand.
Uncomment each program as you go along. Make sure you document your variables.
script
command, giving the name of a script file.
rm
command. rm *.class
will delete all files that
end in .class
. Be careful--- don't delete your .java
files!
a2ps -P sp
(name of script file).
a2ps
prints the file in "2-up" mode. Remember that
sp
is the name of the printer.
Make sure you have exited the script file before you print, or else it will print forever!
Then turn in the hard copy to me.