Lab 4: Loops and arrays

The goal of this lab is to practice writing programs with loops, switch statements, and arrays.

Make a new directory, as usual. Then make a file from scratch containing an interactive program that operates on arrays. Specifically, which does the following.

Turn-in

  1. Start a script. Remember this is done using the script command, giving the name of a script file.
  2. Delete any class files. This is done using the rm command. rm *.class will delete all files that end in .class. Be careful--- don't delete your .java files!
  3. Print the file
  4. Compile the program, as you did before.
  5. Run the program, as you did above.
  6. Exit the script.
  7. Print the script. I recommend using 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.


Thomas VanDrunen
Last modified: Sat Sep 16 21:48:30 CDT 2006