CS 307 - Fall 2001
Assignment 1, Communications and Process Test, Simple Java Expressions, and two Simple Programming Problem

Handed Out:    September 10, 2001
Due:    Before 11:59 p.m. September 17, 2001 via email to Mike

Purpose: To give you practice using the required course software tools, meet the teaching team, evaluate expressions in Java, and write two simple program in Java.
Provided classes: Test.java

  1. Look at the file Test.java.  Predict what will be printed out when the program is run for each question (Numbers 1 - 26.)  After completing and recording your predictions try to compile the program.  There are a number of syntax errors in the file.  Fix these and run the program. If you get any runtime errors (exceptions) you will need to fix these as well.  For each question put your prediction, the actual answer (or if it was a syntax error or runtime error), and finally explain the actual result.

    Example:

    //number 0
    int x = 5;
    x++;
    x = x + 3;
    System.out.println(x);

    /* This comment would be at the bottom of Test.java
     * Number 0. predicated answer 9.  actual answer 9.
     * Explanation. The integer variable x is initially assigned the
     * value 5. 1 is added to it via the postfix increment 
     * operator so it now 6.
     * x is then assigned the old value of x (6) plus 3, 9
     * value of x when printed is 9.
     */

  2. Complete programming exercise 1.19 on page 25. Implement a single static method in Test.java for the problem that prints out all of the answers. Be sure to following the class coding standards.

  3. Complete programming exercise 1.21 on page 25. Implement a single static method in Test.java for the problem that prints the required information.

  4. Turn in your assignment via the email to Mike. Remember to put your name and the assignment number in the header of the email.


Back to the cs 307 homepage.