Question: Create a Java class called Rectangle. A rectangle should have a width and a length Use encapsulation and create appropriate getter and setter methods. Create
Create a Java class called Rectangle. A rectangle should have a width and a length Use encapsulation and create appropriate getter and setter methods. Create appropriate constructors that do the same, ensure that you have a zero argument constructor to set appropriate default values. Write a toString method for the rectangle that prints out the dimensions as well as the perimeter and area. Create a main method that creates several rectangles. Use the toString method of the rectangle to print out the information. Test the equals method to show that two rectangles are equal.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
