Question
Write a superclass encapsulating a Rectangle. A Rectangle has two attributes representing the width and the height of the Rectangle. It has a constructor, getter
Write a superclass encapsulating a Rectangle. A Rectangle has two attributes representing the width and the height of the Rectangle. It has a constructor, getter and setter methods and worker methods that return the perimeter and the area of the Rectangle. The Rectangle class has a subclass, encapsulating a box. A box has a Rectangle as its base, and another attribute, its length; it has two worker methods that calculate and return its area and volume. You can write a single tester class to instantiate a Rectangle object or two and test each method in the Rectangle class. Then instantiate a box or two and test the constructor, getters, and worker methods.
Paste the output from the tester in a multiline comment at the end of the class
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started