This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Midterm Exam Practice Lab

Saving and Loading Shapes (30pts)

Download the following files:

  1. Rectangle.java (finished) - A simple rectangle class that stores width and height as integers.
  2. Square.java (finished) - A subclass of Rectangle. A Square is-a Rectangle with equal width and height.
  3. ShapeUtils.java (UNFINISHED) - File I/O methods. This is the only file you will need to submit.
  4. ShapeUtilsTest.java - Submission tests, in case you want to test locally before submitting.
  5. shapes.txt - Sample text file illustrating the correct file format.

Finish the two unfinished methods in ShapeUtils.java so that they conform to the provided Javadoc comments.

Submit your completed ShapeUtils.java via Gradescope .