CSSE 221: Fundamentals of Software Development Honors

Homework to do before week 1 (due before beginning of class on Monday, Sept. 6)

Key

  1. If you had any problems installing Eclipse, TortoiseSVN, or Subclipse, as references in Homework 0, fix them. There will be an assistant in Moench F217 from 7-9pm on Thursday and Sunday nights to help you.
  2. Finish the JavaEyes assignment, including the questions below.
  3. Read the assignment in BigJava to prepare for Monday's class. What is it? See the schedule page! (Yes, it's chapters 1-3). These should be review, but if you are really rusty on your Java (or haven't learned Java yet), you will want to read these more carefully to help answer the questions. 
  4. Do the following written problems. Please bring hardcopy to class to hand in Monday. They must be neat (either typed or handwritten neatly), and printed and stapled by the beginning of class.
    1. How many classes are in the JavaEyes project?
    2. How many methods does the AnimatedPanel class in JavaEyes have?
    3. How many constructors does the AnimatedPanel class have?
    4. How many fields does the AnimatedPanel class have?
    5. How does Eclipse let you determine all of the above answers quickly, without looking at the actual code?
    6. How would the design of JavaEyes have to change if we were to add an eye that moves independently of the others? For instance, perhaps it continually rolls around clockwise. For this written part, concentrate on how the class structure should change, not the exact implementation of the rolling eye.
    7. What is the value of each variable after running the following block of code?
      int x = 0, y = 0, z = 10;
      while (x < z) {
      	y = y + x;
      	if (y > 10) {
      		y = y / 2;
      	}
      	x++;
      }
      
    8. Rewrite the above segment of code using a for statement.
    9. Consider a Clock class that has hour and minute fields, a constructor to initialize a time, and a tick() method to advance the time by one minute.
      1. Consider the code:
        	Clock clock1 = new Clock(2, 43);
        	Clock clock2 = clock1;
        	clock1.tick();	
        	
        How many clocks have been constructed in the above code? What time is stored in clock2 after the code executes?
      2. Fill in the body of the following javadoc'd compareTo() method:
        /**
         * Compares this object with the Clock on the right-hand side. 
         * 
         * @param rhs (right-hand-side) The object with which to compare this Clock.  
         * @return -1 if this Time comes before rhs (if both are in the same day), 
         * 1 if this Clock comes after rhs, 
         * and 0 is they are equal. 
         */
        public int compareTo(Object rhs) {