Question: ***PLEASE SOLVE THIS PROBLEM IN JAVA I. Design and code a class Rectangle that has the following properties: Two private members double length and width
***PLEASE SOLVE THIS PROBLEM IN JAVA
I. Design and code a class Rectangle that has the following properties:
Two private members double length and width
A constructor that accepts two parameters for the private members
Default constructor that sets both members to 0
Accessor for each private member
Mutator for each private member
Method area() that returns the area of the rectangle
Method Perim() that returns the perimeter of the rectangle
Method toString that return the param as a String
Method Add that accepts a Rectangle and returns a rectangle with length as sum of lengths of this and the input rectangle and the width as the sum too.
Method equals() that accepts a rectangle and returns true if the two rectangles are the same and false if not.
II. Write a program to test the Rectangle class. Try to use as many of the public constructors and methods as possible.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
