Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A cheese factory fills it products in box shaped containers. Write three classes Cheese, Rectangle, and Box that represent the factory product. Define the class
A cheese factory fills it products in box shaped containers. Write three classes Cheese, Rectangle, and Box that represent the
factory product.
Define the class Cheese, with private data member type of type string, costPerCubicCentimeter of type double, and the public
member functions set getCost print and the default parameterized constructor with values and
Define the class Rectangle with protected data members length, and width both of type double. The class also has the public
member functions set print findArea and the default parameterized constructor with values and
Define the class Box, which publicly inherits the class Rectangle. It has the private data member height, price of type double,
Asda of type Cheese, and the member function findPrice The class has the public member functions set findVolume
print and the default parameterized constructor string double double double double
Implement all member functions using the least privileged principle.
Use the following driver, and print functions:
int main
Box Jiben;
Jiben.setCheddar;
Jiben.print;
return ;
void Cheese::print const
cout "The cheese type is: type endl;
cout "The cost per cubic centimeter is:
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