Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c++ language Assume we have a store that produces two types of Products: Food and Clothes, Q1: Each Product has: - Product number (type

in c++ language
image text in transcribed
Assume we have a store that produces two types of Products: Food and Clothes, Q1: Each Product has: - Product number (type int) produced automatically where each product will have the number 1, the second will have the number 2 etc. - A quantity (type int) and - The unit price (type float). Implement the base class Product with the needed functionality to store and retrieve the product number. description quantity, and unit price. A pure virtual function isFood of type bool and a virtual function print function Q2: To represent the product Food, a new class Food derived from the base class Product is to be defined with the functionality of a Product, but in addition Store and retrieve the Unit (Kg, Pieces. Box, ... etc.) of type string isKG(String date) function to test if the product is expired or not compared to a given date is to be provided too. The Print function must be redefined to output all the information of an object of the class Food. - The isFood function must be implemented here. Q3: To represent the Clothes, the class Clothes is derived from the class Product, but in addition: -Store and retrieve the size (positive int), the color of type String. The Print function must be redefined to output all the information of an object of the class Clothes. - The isFood function must be implemented here. 04: Store Class: That Store and retrieve a name of typre string, const max of type int, num of product of type int and an array of products Parametrized Constructor Setters (name, num of product, array of products) Getters (name, max_capacity, num of product and GetProduct at(int i)) Q5: To test these classes, write a main program using dynamic memory allocation to test the 3 classes you have written - Define an array of products of size 10. This array will contain two types of products (food, clothes). - Let user input the data needed for each object interactively. Finally, print all the information about each object in each array. - Create a store object MyStore; and pass the needed parameter through its constructor - Count the number of foods that Mystore has. - Print out what do we have more clothes or food objects

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

Students also viewed these Databases questions

Question

1. Who should participate and how will participants be recruited?

Answered: 1 week ago

Question

3. How would this philosophy fit in your organization?

Answered: 1 week ago

Question

How would you assess the value of an approach like this?

Answered: 1 week ago