Question: Using C++ conduct the following Create a class Rectangle that has data items such as length, width and height as double. Initialize the data values

Using C++ conduct the following

Create a class Rectangle that has data items such as length, width and height as double. Initialize the data values in the default constructor. Write get methods for each data items. Write set methods for each data items to assign a value to a data item. Write a method called calc_area that calculates area (which is length * width) of the rectangle and return the result as double value. Write a method called calc_ratio that calculates ratio (height / width) of the rectangle and return the result as double value. Write another method called calc_vol that calculates the volume of rectangle which is volume= + 2 the method return the volume variable. Create two objects of class Rectangle, and read data of the class variables and find out area, ratio and volume of both objects and display.

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!