Question: Design a class named Rectangle to represent a rectangle. The class will contain: * Two double data members to hold the width and height of

Design a class named Rectangle to represent a rectangle. The class will contain: * Two double data members to hold the width and height of the rectangle; * A default constructor that creates a rectangle with width and height equal to 1.0; * A constructor that accepts two parameters of type double and creates a rectangle with the width and height equal to the values of its parameters; * Accessor and mutator functions for all the data members; * A member function getArea() that returns the area of the rectangle; * A member function getPerimeter() that returns the perimeter of the rectangle. Write a main function that uses the Rectangle class; the program will prompt the user to enter values for width and height of the rectangle, then create a Rectangle object with the specified values and output the rectangle's area and perimeter.

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!