Fall 2013 CSCI 202 Homework 7

This assignment must be completed by 10:10 AM on Saturday, 19 October, and uploaded to the Homework 7 moodle page. You should upload only your RotatedRectangle.java file.


This is a smallish assignment to try to bring Homework 6 to the standards used in CSCI 181 and in the textbook.

Getting starting

Start with the RotatedRectangle code you wrote for Homework 6. If you didn’t do that homework, I’ll try provide you with a copy written by another student.

The tasks

Implementing toString

Implement a good toString method following the suggested practice of section 9.5.1 (pp. 448 to 449) and special topic 9.6 (p. 453) of the textbook.

Implementing equals

Implement a good equals method following the suggested practice of section 9.5.2 (pp. 450 to 451) and special topic 9.7 (pp. 454-454) of the textbook.

Implementing clone

Implement a tolerable clone method following the suggested practice of special topic 10.2 (pp. 475-477) of the textbook. Also, modify your class header so that it extends the Cloneable interface.

This is much easier to do with the RotatedRectangle than with the BankAccount

Implementing a copy constructor

Implement a good copy constructor. A copy constructor takes a single argument, another RotatedRectangle, and makes a copy of it.

Obviously, the copy constructor will be very similar to the clone method. There are several well-known Java gurus who say that Java’s clone and Cloneable paradigm is “broken” and should never be used. I understand that in CSCI 181 Java classes have copy constructors but not clone methods.