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. 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.