Introduction

This individual exercise has four problems. The code can be found in this ZIP file.

review_oo/
   src/
     # the root package for this activity
     rit/
        # the class for exercise 1
        Color.java
        # the classes for exercise 2
        Animal.java
        Dog.java
        Spider.java
        # the package for exercise 3
        calculator/
           CalculatorApp.java
        # the package for exercise 4
        subsystem/
           # more classes here for exercise 4

For ease of development, I recommend that you import the review_oo directory as a project into your favorite IDE. If you do not know how to do that reach out to either the instructor or assistant.

EX1: Fixing OOP violations

  1. Review the Color class.
  2. Identify the OO principle being violated and type the name of the principle into the class javadoc.
  3. Fix the code to follow the principle.

EX2: Cleaning up a class hierarchy

  1. Review the Animal, Dog and Spider classes.
  2. What's wrong with this class hierarchy?
  3. Fix the code to form a clean class hierarchy.

EX3: Implement a design

Your task is to implement the follow subsystem design:

UML model of the class design of a Calculator app.

The CalculatorApp class is in the rit.calculator package. Your task is to write the rest of the code.

  1. The CalculatorApp main class is provided with code to calculate the hypotenuse using the Pythagorean theorem.
  2. Create the remaining classes in the UML design.
  3. Ensure that the CalculatorApp runs and displays the string Pythagorean theorem works! sideC = 5.0

EX4: Model a subsystem

Creating a model from a code base is frequently part of reverse engineering an application, or more likely just a subsystem. This sometimes occurs when a team needs to update part of the system that developers have not touched in years. The original developer might not even work in the same group anymore.

Your task is to create a UML class diagram of the five classes in the rit.subsystem package.

  1. Use any tool or drawing application to create the UML class diagram.
  2. Copy an image or PDF of the class diagram to the review_oo project directory.
  3. When you complete all of these activities you will ZIP up the project directory including this diagram.

Dropbox submission

Use the command zip -r review_oo.zip review_oo to pack all of your code changes into a single review_oo.zip archive file. Upload that file to the Review OO concepts - individual Dropbox in myCourses by the due date specified in your section's schedule.