Question: Objectives: Continue practicing past concepts Practice building basic C + + classes Practice building C + + classes that use inheritance Assignment: Build the three
Objectives:
Continue practicing past concepts
Practice building basic classes
Practice building classes that use inheritance
Assignment:
Build the three classes defined below:
Inventory base class
Book derived class
Puzzle derived class
The UML diagrams for the classes are as follows:
tablePuzzle category; string ageRange: string pieceCount: int
tableInventory# name: string# itemDescription: string# itemID: string# stockNumber: int Inventory getName: string getltemDescription: string getltemID: string getStockNumber: int setNamestring name: void setltemDescriptionstringitemDescription: void setltemIDstring itemID: void setStockNumberint stockNumber: void
tableBook pageNumber: int author: string genre: string publisher: string Book Bookstring name, string itemDescription,string itemiD, int stockNumber, int pageNumber,string author, string genre, string publisher getPageNumber: int getAuthor: string getGenre: string getPublisher: string setPageNumberint pageNumber: void setAuthorstring author: void setGenrestring genre: void setPublisherstring publisher: void
For these classes, all getterssetters are standard getterssetters They also have constructors with parameters that should set their variables and the variables of Inventory.
Once you've verified your classes work as intended, create a main file to use the classes. Your main function should first establish two vectors: one of Book type, one of Puzzle type. Then, you should take in a file you should verify this file exists in a loop and open it for reading inventorytxt and store.txt have been provided to you
The file format should have each contact indicated by "book" or "puzzle". Then, you'll read from the file a certain number of times. Each field ie name, item description, item ID etc will be on separate lines. Take a look at the file given to see the order of the fields. This means, NOT including the bookpuzzle tags, book entries will have lines and puzzle entries will have lines. Build the appropriate object based on the tag and add it to the appropriate vector. Loop reading from the file until all items are read.
Once you're done reading from the file, close the file. Then, display all of the items to the user in nicely formatted manner example given in execution screenshots!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
