Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Define a class of rectangles. Please name your test program as RectangleTest How to hand in the assignment Follow the steps below: Complete the UML
Define a class of rectangles. Please name your test program as "RectangleTest"
How to hand in the assignment
Follow the steps below:
Complete the UML in a Microsoft Word document or other document file format,
and the programs in java files. Once you are done, convert your UML file to a
PDF pdf
Upload the java files as well as the PDF document UML into Gradescope. Do
not submit a docx file for the UML, first convert your file to PDF pdf
Click "Upload".
I remind you that if you do not submit the assignment before the due date, you will not be
able to submit it
Note: Your output should look exactly like the output below and should be able to
run test cases.
The width before is
The height before is
The width after is
The height after is
The area is
The perimeter is
Design a class named Rectangle. The class contains:height of the rectangle. The default values are for both width and height.
A noarg constructor that creates a default rectangle.
A constructor that creates a rectangle with a specified width and height.
Two sets of get and set methods for the two private data fields.
A method named getArea that returns the area of a rectangle.
A method named getPerimeter that returns the perimeter.
Please make sure to follow this sequence of steps:
Draw the UML of the Rectangle class. The data fields should be private, and
constructors and all other methods should be public.
Implement the Rectangle class name it "Rectangle" in Rectangle.java.
Implement the RectangleTest class name it "RectangleTest" with the main
method in RectangleTest.java. It should do the following tasks:
Create a rectangle object with width and height
Change the rectangle's width to and height to
Print out the area of the rectangle.
Print out the perimeter of the rectangle.
Grading: This lab is worth points. Out of maximum points, the UML will
count for points, the two source codes will count for points.
Submission:
For this assignment, please name your class file as "Rectangle"
package homework;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started