Question: 3) Consider the following class and then answer the questions that follows: public class Rectangle { private double length; private double width: private double area;

3) Consider the following class and then answer the questions that follows: public class Rectangle { private double length; private double width: private double area; public Rectangle(double I, double w) { length=; width=w; } public void calculate Areal) { area=length*width; public String toString() { return String.format("Length=%.2f%nWidth=%.2f%nArea=%.2f",leogth widthacea); 3 public double setlength() { return length; } public void setlength double length) { thisJength-length; } 3.1 In the space provided beneath the getLength() and setLength() methods, insert new accessor and mutator methods for the width instance variable. (1 Point) 3.2 Assume that after instantiating a Rectangle object and the area is calculated by calling the method calculate Area(), the length was lost due to calling the setLength() method with a different length (i.e., the original length was overwritten and hence lost). Define a new method called recoverLength() that is used to recover the length. Insert the new method following the methods you inserted in 3.1. Hint: Think of how you can use the area and other details provided to recover the length. (1.5 Point)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
