143k views
0 votes
Write a superclass encapsulating a rectangle. A rectangle has two attributes representing the width and the height of the rectangle. It has methods returning the perimeter and the area of the rectangle. This class has a subclass, encapsulating a parallelepiped, or box. A parallelepiped has a rectangle as its base, and another attribute, its length; it has two methods that calculate and return its area and volume. You also need to include a client class to test these two classes.

1 Answer

4 votes
That’s how you do it times the box and the rectangle to have a parallelepiped
User Stefano Siano
by
5.2k points