Answered step by step
Verified Expert Solution
Link Copied!

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 0.
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 0 and 0.
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 =0, double =0, double =0, double =0).
Implement all member functions using the least privileged principle.
Use the following driver, and print functions:
int main()
{
Box Jiben;
Jiben.set("Cheddar",0.25,4,7,3);
Jiben.print();
return 0;
}
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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The New Profit Frontier

Authors: Ed Burnett

1st Edition

0964535629, 978-0964535626

More Books

Students also viewed these Databases questions

Question

13. Identify the refusal of the return in Dances with Wolves.

Answered: 1 week ago