CSSE 220 – Object-Oriented Software Development

Homework 2

Objectives

Practice with primitive types, objects, and methods in Java.

Tasks

  1. Complete the assigned reading for the next session, according to the course schedule. Since HW2 is due at the start of session 3, look under the reading column at session 3. (It is Big Java §2.8–2.10, the first two pages of this intro to UML Class Diagrams, and Big Java §3.1–3.8.)
  2. Complete the assessment exercises over this reading on ANGEL (under Lessons → Assignments).
  3. Eclipse configuration:
    1. Setup Java API documentation in Eclipse.  This should already be done for you.  If this is not already setup for you (see slide entitled "Java Documentation in Eclipse"), you can follow these instructions to  complete the configuration.  You want to follow the instructions under the section with header "Download and unZIP the Java Documentation".
    2. This part is optional:  If you desire to generate javadocs for a project in html format, it is not too difficult to do do so.
      • From the top menu, click on Project → Generate Javadoc → accept defaults
      • Find the Javadoc command at C:\path_to_your_Java_installation\Java\jdk1.6.version_number\bin\javadoc.exe (you may want to browse to this path).
  4. Programming: We started these in class. Please finish them and commit your answers to your SVN repository.
    1. In Eclipse, checkout the ObjectsAndMethods project.

      • Use the SVN Repositories view to check out this project.
    2. Edit the file SomeTypes.java, completing each of the TODO items listed in the main() method.
    3. Edit the file FourRectanglePrinter.java as follows:
      1. Construct a Rectangle object using the four random values generated for you. Store the object in a new variable named box.
      2. Print the location of the rectangle by calling System.out.println(box).
      3. Translate and print the rectangle three times, so that, if the rectangles were drawn, they would form one large rectangle:
        Expecting locations for translated rectangles

      From BigJava, Exercise P2.3

    4. Edit the file StringPractice.java, completing each of the TODO items in the file.
      • The UML class diagram for String in the session 2 slides gives all the String methods that you will need.

Remember, in all your code:

Here is the grading rubric for this assignment.

Turn-in Instructions

Turn-in your programming work by committing it to your SVN repository.