Question: Design and implement the class Rectangle to represent a rectangle object. The class defines the following attributes (variables) and methods: get 1. Two class variables

Design and implement the class Rectangle to represent a rectangle object. The class defines the following attributes (variables) and methods: get 1. Two class variables of type double named height and width to represent the height and width of the rectangle. Set their default values to 1 in the default constructor. 2. A non-argument constructor method to create a default rectangle. 3. Another constructor method to create a rectangle with user-specified height and width. 4. Method getArea() that returns the area. 5. Method getPerimeter() that returns the perimeter. 6. Method getHeight() that returns the height. 7. Method getWidth() that returns the width.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!