Question: Given the code below public class Rectangle { private double length; private double width; // setters and getters public double getLength(){???} public void setLength(???){???} public
Given the code below
public class Rectangle {
private double length;
private double width;
// setters and getters
public double getLength(){???}
public void setLength(???){???}
public double getWidth(){???}
public void setWidth(???){???}
// object method
????calculateArea(){????}
????isSquare(){????}
}
a. Complete the appropriate Getter methods.
b. Complete the appropriate Setter methods - including the parameters required
c. Complete a method so that the method calledcalculateArea() returns the area of the rectangle.
d. Complete a method so that the method calledisSquare() returns true if width is equal to length, otherwise return false.
e. Create an object obj and set its length as 10 and width as 7. Print its area and tell if it is a square.
Step by Step Solution
There are 3 Steps involved in it
a Getter methods public double getLength return length public do... View full answer
Get step-by-step solutions from verified subject matter experts
