Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ PROGRAM 1-Develop a class called WritingTools with properties such item pric

ID: 2246786 • Letter: C

Question

C++ PROGRAM

1-Develop a class called WritingTools with properties such item price location and name.

2- create a new class called item more generic than the first one you developed. It should include general characteristic for all items and other writing a color

3-You have added a new category called food. You already worked on WritingTools but you have inherit the propertie from item.

4-Create the new class for Food. It varies from WritingTools that the expirationdate and isrefrigerated is added

5- Use the concept of inheritance between item and writingTool and item and FoodItem

6-Each inheritance overloads the constructor of item, depending on the parameters sent.

7- The main menu now asks before entering an item if you want to enter food or WritingTools

8-Thinking task: how can I store both types? (think ahead to multiple item types)

Do a main: showing a menu :the rpogram have a menu of the following options:

Option 1- User selects too add a new item

Option 2-User selects the category to add the item(between food or writing toos)

Option 3-User Selects the category of the item

Option 4- User enters an item

hint: create two arrays from Class writingTools and class food to store the data asked to the user

Explanation / Answer

#include <iostream>
using namespace std;
class WritingTool
{
public:
string name;
string location;
double price;
string category
WritingTool(string name,string location,double price, string category);
void display()
{
cout << "name: " << name << endl;
cout << "location: " << location << endl;
cout << "price: " << price << endl;
cout << "category: " << category << endl;
}
};

class Food
{
public:
string expirationDate;
string isrefrigerated;
Food(string expirationDate,string isrefrigerated);
void display()
{
cout << "expirationDate : " << expirationDate << endl;
cout << "isRefrigerated : " << isrefrigerated << endl;
}
};

class Item : public WritingTool, public Food
{
public:
string creationDate;
string brand;
Item(string name, string location, double price,string category);
Item(string name,string creationDate,string brand);
Item(string name, string expirationDate,string isrefrigerated);
void display()
{
cout << "Brand: " << brand << endl;
cout << "Item creation date : " << creationDate << endl;
}
};

int main (){
WritingTools *writingTools[1];
Food *foodItems[1];
string name;
string expDate;
string isrefrigerated
string location;
double price;
string category;
cout << "Add the item name";
cin >> name;
cout << "Add the exiration date";
cin >> expDate;
cout << "Add whetther isRefrigerated or not";
cin >> isrefrigerated;
cout << "Add the location";
cin >> location;
cout << "Add the price";
cin >> price;
cout << "Add the category ";
cin >> category;
foodItems[0] = new Food(name,expDate,isrefrigerated);
writingTools[0]= new WritingTools(name,location,price,category);
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote