CSSE 220 -- Object-oriented Software Development

Homework 6 Due at 8:05 AM on Day 7. 
Written problems due at the beginning of your class period.

  1. Complete the assigned reading for the next session (see the course schedule). If there is something you do not understand, make note of it so you can ask about it.
  2. Begin to look at the Key Concepts from the end of chapter 4.  This is a good place to quickly notice things you might have missed from the chapters. At some point (most likely Day 10) we will have a "Key concepts quiz" over chapters 1-4.
  3. Complete the Angel quiz over the previous reading. You'll find this on the course Angel page, under Lessons → Assignments → Reading Quizzes → Quiz 5.   This quiz will be available Thursday afternoon, and will cover Weiss Sections 4.2-4.4.4.
  4. Do the written exercises that are listed below.  You may write them neatly by hand or do them on your computer and print them. Turn in hard copy at the beginning of the Day 7 session. Include your name and section number at the top of your paper. 
  5. Finish the Unit Testing Exercise from class. The goal is to have a completely working PigLatiner.transform method (I.e. it does the right thing for any argument that we can pass to it), and a collection of JUnit tests that assure us that this is really  the case.  When you have completed this, share your project to your SVN repository.
  6. Finish the code for your BigRational class. You should also try to complete the Unit Tests so you do not have too much to do after Monday's class, but it is okay if you do not finish the unit tests until Day 8 at 8:05.

Written problems

  1. (3 points)  Weiss exercise 3.11.  Read the first sentence as " ... a single private constructor and no other constructors."
  2. (7 points)  Weiss exercise 4.6.  Be sure that you do all seven parts (some are on the next page).
  3. (8 points) List the number of each of the statements in the main( ) method of the following program, that would have to be commented out in order to make this code compile and run.  For each statement that you list, explain why it is illegal.
       public class HW6StaticMethods {
      
       public int pi;
       public static int psi = 5;
       
       public static int triple(int i) {
          return 3*i;
       }
       
       public int quadruple(int i) {
          return 4*pi;
       }
       
       public HW6StaticMethods(int i){
          this.pi = i;
       }
       
       public static void main(String[] args){
          
          HW6StaticMethods hw6 = new HW6StaticMethods(12);
          /*1*/ System.out.println(pi);
          /*2*/ System.out.println(psi);
          /*3*/ System.out.println(quadruple(6));
          /*4*/ System.out.println(triple(7));
          /*5*/ System.out.println(hw6.pi);
          /*6*/ System.out.println(hw6.psi);
          /*7*/ System.out.println(hw6.quadruple(6));
          /*8*/ System.out.println(hw6.triple(7));
          
    }