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 and the first two pages of this intro to UML Class Diagrams.)
  2. Complete the assessment exercise 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 UsingStrings.java, completing each of the TODO items listed in the main() method.
    3. Edit the file SomeTypes.java, completing each of the TODO items listed in the main() method.
    4. 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

    5. Edit the file WordGames.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.
    6. Remember, in all your code:

      • Write appropriate comments:
        • Javadoc comments for public fields and methods.
        • Explanations of anything else that is not obvious.
      • Give self-documenting variable and method names:
        • Use name completion in Eclipse, Ctrl-Space, to keep typing cost low and readability high.
      • Use Ctrl-Shift-F in Eclipse to format your code.
      • Take care of all auto-generated TODO’s.
        • Then delete the TODO comment.
      • Correct ALL compiler warnings.
        • Quick Fix is your friend!

      Here is the grading rubric for this assignment.

Turn-in Instructions

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