Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(C++ Program) I am having a hard time trying to complete this program i need help. 1. You are to implement the Consumables and the

(C++ Program)

I am having a hard time trying to complete this program i need help.

1. You are to implement the Consumables and the Accessories class, create files for each containing any number of consumables and accessories. (make sure they contain all the information needed).

2. All files have _ (underscores) for the spaces. I show how you remove the spaces for the weapons, you should remove the spaces for all of the words. **challenge is placing them back when you write to the file** 3. In the main, have the ability to show all the (weapon / armor / accessories / consumables) depending what the user wants to see. display those items only. 4. When the program exits, save all the items back in their respective file. To know what each item is, you will need to create a variable in Item called whatIsIt which holds a string holding the item type, so if your object is a weapon, it will say weapon. This variable should go between the name and the description. You will need to UPDATE all files, all the classes, the way you infile and outfile in order for the program to work well with this new variable. ** also, make sure you start your files with the number of items in the file, so when you are saving everything back to the file, you need to know how many of those items there are... (maybe sort based on item type?)

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

( please show comments and output)

#include #include #include using namespace std; ll This is the base class class Item private string name iwhatlslt goes here string description; double weight; public: iithese two are the constructors, they will be changed once you include the /whatlsit variable. ltem()(name-"NULL", description-"NULL", weight = 0;} Item(string name, string description, double weight) this->name name this->description description; this->weight weight string getName(return name:) void setName string nameXthis->namename) string getDescription0(retun description: double getWeightKreturn weight:) void setWeight(double weight)fthis->weight weight) virtual void display( cout #include #include using namespace std; ll This is the base class class Item private string name iwhatlslt goes here string description; double weight; public: iithese two are the constructors, they will be changed once you include the /whatlsit variable. ltem()(name-"NULL", description-"NULL", weight = 0;} Item(string name, string description, double weight) this->name name this->description description; this->weight weight string getName(return name:) void setName string nameXthis->namename) string getDescription0(retun description: double getWeightKreturn weight:) void setWeight(double weight)fthis->weight weight) virtual void display( cout

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

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions

Question

How would you describe your typical day at work?

Answered: 1 week ago