Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

IN JAVA: Create a Box class that is derived from your rectangle class ( a box is

ID: 3805067 • Letter: I

Question

IN JAVA: Create a Box class that is derived from your rectangle class ( a box is a rectangle with an added dimension - height). Add 2 methods area and volume.

When you create these methods use the area method from Rectangle. Note that volume is the Rectangle's area times the height. I'll leave you to figure out the surface area. Hint: Make 2 more rectangles.

Rectangle.java:

public class Rectangle {
  
private double width;
private double length;
public Rectangle() {
length=1;
width=1;
}
  
  
public double getLength(){
return length;
}
public double getWidth(){
return width;
}
public void setLength(double l){
  
length=l;
}
public void setWidth(double w){
  
width=w;
}
public double area() {
return width * length;
}

public double perimeter() {
return 2*(width+length);
}
}

Explanation / Answer

Below is the required class:-

Thank you.