CS 1043 Lab 1 Fall 2000

Wainwright

Purpose: To become familiar with fundamental Unix commands, the Pico Editor and the compiling and execution of a simple java program in the Unix environment.

Students will also learn how to build a script file, and print the script file to the printer.

  1. Log on to an ENS Windows NT PC in room L1 (KEH)

2. Open a window to login to Euler (Unix system):

  1. Start – Programs – QvtNet – QVT-Term
  2. file – open
  3. In the Host Name or IP Address enter: euler.mcs.utulsa.edu
  4. Login to the Euler Unix Computer
  1. In your home directory, make a new directory as follows: mkdir lab1
  2. then change directory to lab1 as follows: cd lab1

  3. Note example java code from the textbook is located on Euler at:
  4. /home/cs1043/java2-textbook

    and example java programs from your instructor are located on Euler at:

    /home/cs1043/java2-examples

  5. Copy the program, Coins4Lab1.java from /home/cs1043/java2-examples to your
  6. directory and rename it as lab1.java as follows:

    cp /home/cs1043/java2-examples/Coins4Lab1.java lab1.java

    cp /home/cs1043/java2-examples/ConsoleReader.java ConsoleReader.java

    cp /home/cs1043/java2-examples/ConsoleReader.class ConsoleReader.class

    Use Pico to edit lab1.java until you get it to compile. Note I have placed several syntax and logic errors in this program.

    ADD A COMMENT IN YOUR PROGRAM THAT STATES YOUR NAME AND ALSO THAT THIS PROGRAM IS FOR LAB1. Remember the compile and execute commands are:

    javac lab1.java

    java lab1

  7. Add code to lab1.java to ask for the number of half dollars and the number

of dollar coins, and all necessary code to accomplish this.

8. Create a script file and print the script file as follows:

script script.lab1

cat lab1.java

javac lab1.java

java lab1

... in here use 2 pennies, 3 nickels, 4 dimes, 5 quarters,

6 half dollars, and 7 dollars.

exit

9. Print the file, script.lab1, and turn it in to your LAB Instructor.

  1. To logout of the Euler (Unix) System: type logout. In the window, click
  2. file - exit. This will take you back to the Windows NT System.

  3. Logout of the Window NT PC (start – shutdown – OK)

12. For your convenience, I have included a copy of the file, Coins4Lab1.java

on the reverse side of this page. Try to locate the errors before you go

to lab. It will save you some time.