PHW3: Square Class with Outline

So far we have created a Circle and Square class. Next we’ll update your Square class by adding support for an outline color.

Rx: <10 min Av: 10-20 min Sd: 20-30 min DNF: 30+ min

Instructions

  1. Start your timer
  2. If you haven’t been following along, download the Shapes Project and import it into your workspace.
  3. Add a new field, outlineColor, to the Square class.
  4. Update the constructors to support the outline. You should have 3 constructors:
    • Default constructor (no parameters)
    • Constructor with 4 parameters (no outlineColor)
    • Constructor with 5 parameters (one for each field)
  5. Add get & set methods for the outline color
  6. Update the draw method to draw the outline.
  7. Test your Square changes in Picture.
  8. Run the program to verify your changes.
  9. Stop your timer

Demonstration

Once you’ve finished doing the PHW a single time, watch me do it:

Standard Practice HW Advice

You’ll learn significantly less from watching me solve the practice HW if you haven’t attempted the HW yourself first.

While it’s an achievement to finish the HW no matter how long it takes, you might experience “diminishing returns” if you work longer than the DNF time. Thus, it might be strategic to stop working at the DNF time and watch my solution.

After watching my solution, I recommend that you repeat the HW if you have not achieved at least Av performance. If so, be sure to:

Feel free to keep trying until you make Rx if that’s of interest to you.