So I'm in a beginner
java programming class and have this assignment (see attachment) I'm not asking for the work to be done for me, but I'm not understanding how to do the syntax of both parts. Help please?
Program 8 – Classes
30 points – 15 per class
1. Create a RectangleFL (replacing FL with your first and last initial) class with the following UML:
RectangleFL
-length: double
-width: double
+Rectangle()
+Rectangle(double, double)
+setLength(double): void
+setWidth(double): void
+getLength(): double
+getWidth(): double
+calcArea(): double
+calcPerimeter(): double
+makeCopy(RectangleFL): void
+getCopy(): RectangleFL
---------------------------------------------
The set methods should verify that the length and width are each double numbers larger than 0.0 and less than 20.0. The default length and width are 5.0 if none are provided in the instantiation. Save and cleanly build this .class file.
2. Create a Lastname08 class that will
test the RectangleFL class.
a. This program should instantiate at least two objects of type RectangleFL.
i. One rectangle can be instantiated with the defaults.
ii. For the second rectangle, you must prompt the user to enter the length and width. Your program should print the length, width, area, and perimeter of each rectangle.
b. This program should change the length and/or width of one of the rectangles and reprint the new length, width, area, and perimeter.
c. This program should make a copy of a rectangle and be able to access that copy. Then compare the copied rectangle to one of the other rectangles to see if they are equal. Appropriate messages should be printed.
d. Build AND run this class/program.
e. Compare your results to mine posted. They should be SIMILAR – don’t have to be exact.
3. Both classes should be heavily commented.
4. Hand in BOTH source code programs (.java) in Bb.