CSCI A201/A597

Lab Notes 1

Spring 2000


Lab coordinators

  1. Please make sure all students have an IUB network ID by asking the students to fill in the Lab1 survey in QuizSite. Students need to log in with their IUB username and network ID. If they can't get in they're either not on the roster, or they don't have a valid IUB network ID. Please write down their usernames and communicate them to me.

  2. Please make sure all students have an IUB NT domain account and each student can create (on the desktop if not on a floppy) a file with Notepad, compile it with javac from the command line (DOS window) and run it with java. Please demo this on the wall projectors if the password I gave you works.

  3. Please write down whether the lab was overcrowded, at full capacity, or the number of empty seats that you had available.

This is in-lab assignment 1 due at the end of the lab next week (Jan 20-21, 2000).


You are to code the following five problems and turn them in to your lab coordinator on a floppy at the end of the next lab.

  1. Create, compile, and run the Hello.java program.

  2. Create, compile, and run the Second.java program from the January 13 lecture notes (which produces the sum of the first 10 integers).

    From now on when we say "write a program" we mean "create, compile and run".

  3. Write a program that lists the first 8 integers from 0 to 7.

  4. Write a program that lists the first 8 integers in reverse order:
    7 6 5 4 3 2 1 0

  5. Write a program that produces the first ___ (your choice here) integers in the following sequence:
    1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, ...

    (That is, the list of integers starting from zero in which each even integer is swapped with the next larger number).

Remember that to implement a program you go through three steps:

  1. Use an editor to create a file (eg, Hello.java)

  2. Open a command window (also know as DOS window) and compile it:
    javac Hello.java
    This creates a .class file (Hello.class)

  3. Run it using the java command:
    java Hello

    Note that we don't specify the extension this time around.

Use the lecture notes, your own imagination, come and see us if you need help.