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
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