This lab has three sections. In Section 1, write a class called Rectangle that represents a Rectangle object. Rectangle objects will have length and width attributes, and they will have perimeter () and area () methods. The Rectangle class should also have get methods for all attributes and set methods for all attributes. The Rectangle class should also have a get Type () method that returns or outputs "Rectangle." In Section 2, write a class called Square that is a child class of Rectangle. A square is a rectangle with equal sides. It should inherit the perimeter () and area () methods. It should also inherit the get and set methods for each attribute, if that is appropriate. The Square class should override the get Type () method from the super class so that it returns or outputs "Square." In Section 3, write a class called Test Driver that demonstrates all of the code in your Rectangle class and in your Square class. Three files: Rectangle.java, Square.java, Test Driver.java. And screen shots in MS Word file.
Get Free Quote!
300 Experts Online