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 today's session (Session 2: Big Java, §1.1–1.2 and §1.6 and §2.1–2.7), according to the course schedule.

    A note on Big Java: Big Java is, well, big. Much of the information in the first few chapters might be review to some students. Please feel free to skim sections that are review, but make it a habit to do the assigned reading. As we move past the first chapters, more of the material will be completely new.

  2. Complete the assessment exercise 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.