Assignments for the first CS120 lab day

  1. Start by creating a new Eclipse Java project Lab1 (or if you prefer a different Java environment to Eclipse, do the equivalent steps in that system). Name your class Lab1, make sure the file is named

    Do not give a package declaration — if Eclipse offers to add one, tell it no; if it automatically adds one to the top of your file, delete it.

  2. Add the following statements to the main routine:
    for(int i=0; i<10; i++) {
      final int squared = i*i;
      System.out.println(i + " squared is " + squared);
  3. Add comments and documentation to your code as required by our class coding style guidelines.
  4. Make sure that your code compiles without error, and runs as you would expect.
  5. Submit the single file to the First lab source code dropbox on D2L. Do not create a ZIP archive, such as by the Export menu from Eclipse! Find the one single file on the file selection dialog, and submit only that file.
  6. Introduce an error into your program which causes it to fail to compile (for example, omit a semicolon, or spell public as pblic). Take a screenshot of what it looks like to have a compile error in Eclipse (or whatever system you are using), and submit that image to the First lab error screenshor dropbox on D2L.

The dropboxes for this lab will open at 10:30am, and close at 3pm, the day of the lab.