Write a inventory program that will manage an inventory of videos owned by the s
ID: 3631548 • Letter: W
Question
Write a inventory program that will manage an inventory of videos owned by the store that buys videos from a wholesaler and then sells them and rents them to customers. It will now also manage a list of customers that are renting the videos.A) Each video record will manage a name , a code number (unique), a quantity owned by the store, a quantity that are currently rented out and a quantity that have been sold.
B) The program will accept the following commands listed below:
C) HELP will list the commands.
D) QUIT will end the program.
E) BUY will prompt the user for a name, code and quantity bought by the store. It will then add the new item to the inventory. (This command is used the first time a specific video is bought by the store from the wholesaler.)
F) REBUY will prompt the user for a code and a quantity bought by the store. It will then add this quantity to the amount owned by the store. (This command is used when the store buys additional videos for an item that it has previously bought from the wholesaler.)
G) RENT will prompt the user for a code and will then increase (by one) the quantity of the number rented out for that video provided that a video is available. Otherwise it will print a polite message saying that no videos are currently available.
H) SELL will prompt the user for a code and will then decrease (by one) the quantity of the number owned by the store and increase (by one ) the number sold provided that a video is available. Otherwise it will print a polite message saying that no videos are currently available.
I) REPORT will neatly display a list all the videos on the screen. For each video listed there will be a name, code, quantity owned by the store, a quantity rented out, a quantity sold and a quantity available for sale or rent.
J) TEST will generate and add 10 random videos to the inventory with appropriate values for all the information on each video. Each of these new videos will have a random name with 3 letters.
K) You will add a new class called Person. Each Person will have a string name and a string phoneNumber and a string address.
L) You will add a new class called Renter which will inherit from Person as described in class. Each renter will have a unique ID number and a vector of integers for keeping track of the video codes of the videos that they have currently rented out.
M) The new command ADD_RENTER will allow a new Renter of videos to be added to the system. Each renter will have a string name, a string phone number, a string address and a integer id number. The command will prompt for each of these fields.
N) The new command REPORT2 will neatly display on the screen the list of all the renters sorted by the renter’s code number. The display will show their ID number followed by the name followed by their phone number. (All on one line.) Indented underneath this line will be listed all of the videos that he or she has currently rented out. Each video in this sub list will include the Code number of the video and the
name of the video. For Example the REPORT2 could display something that looks like this:
Renter IDNumber Name Phone number
0000146 John Doe 555-555-5555
Video IDNumber 0000002 Road Trip
Video IDNumber 0008523 Wine Tasting for Dummies
Renter IDNumber Name Phone number
0007412 Jane Doe 210-555-5555
Video IDNumber 0008523 Wine Tasting For Dummies
VIdeo IDNumber 0008745 Jaws
Renter IDNumber Name Phone number
0002548 John Smith 718-555-5555
Renter IDNumber Name Phone number
0009874 Mary Poppins 866-555-5555
Video IDNumber 0008523 Wine Tasting For Dummies
Video IDNumber 0008745 Jaws
O) The RENT command will also prompt the user for the ID number of the renter. It will also add the Video’s Code number to the list of videos rented out by the specified renter. It will create a polite error message if the entered ID or Code numbers are not valid.
P) The RETURN command will prompt for a Video Code Number and a Renter ID Number and in the Video’s record it will reduce the number rented out by one and in the Renter’s record will remove the Video’s ID from the list of rented records. It will create a polite error message if the entered ID or Code numbers are not valid or if the renter specified has not rented out the video specified.
Q) The class VideoStore will be persistent.
R) You will provide in the same directory as your sln file a file called CriteriaNotMet.txt where you will list the criteria in this assignment that you have not met on a single line separated by commas.
S) The system must now support names of videos and renters that include blanks. It must also support blanks in the address and phone numbers of renters. (Use getline to input these values.)
T) The system must support a LOAD and SAVE command that will allow the entire state of the VideoStore to be saved on the hard drive.
Explanation / Answer
#pragma once #include using namespace std; class VideoItem { public: VideoItem(); //default constructor ~VideoItem(); //deconstructor VideoItem (const VideoItem & vi); VideoItem (string n, int c, int qStore, int qS, int qB, int qRO, int qFS, int qFR); string ToString(); void FromString(string s); static string HeaderString(); string getname(); int getCodeNum (); int getStorequantity (); void setStorequantity (int qStore); int getForSalequantity (); void setForSalequantity (int qFS); int getForRentquantity (); void setForRentquantity (int qFR); void randomize(); private: string name; // name of video int CodeNum; //unique code of video int Storequantity;//quantity store owned int Soldquantity;//quantity sold int Boughtquantity;//quantity bought int RentedOutquantity;//quantity rented out int ForSalequantity; //quantity for sale int ForRentquantity;// quantity for rent }; #include "VideoItem.h" #include "misc.h" #include using namespace std; VideoItem::VideoItem() { name = " "; CodeNum = 0; Storequantity = 0; Soldquantity = 0; Boughtquantity = 0;//quantity bought RentedOutquantity = 0;//quantity rented out ForSalequantity = 0; //quantity for sale ForRentquantity = 0;// quantity for rent } VideoItem::VideoItem (string n, int c, int qStore, int qS, int qB, int qRO, int qFS, int qFR) { name = n; CodeNum = c; Storequantity = qStore; Soldquantity = qS; Boughtquantity = qB; RentedOutquantity = qRO; ForSalequantity = qFS; ForRentquantity = qFR; } void VideoItem::randomize() { name=randString(3); CodeNum=randInt(1,999999999); Storequantity=randInt(10,100000); RentedOutquantity=randInt(0,10000); Soldquantity=randInt(0,10000); ForSalequantity=randInt(0,10000); ForRentquantity=randInt(1,1000); } string VideoItem::ToString() { string result=""; result+=padRight(name,' ',15); result+=padLeft(intToString(CodeNum),'0',10); result+=padLeft(intToString(Storequantity),' ',8); result+=padLeft(intToString(RentedOutquantity),' ',8); result+=padLeft(intToString(Soldquantity),' ',6); result+=padLeft(intToString(ForSalequantity),' ',6); result+=padLeft(intToString(ForRentquantity),' ',6); return result; } string VideoItem::HeaderString() { char fill='-'; string result=""; result+=padRight("Video Name",fill,15); result+=padLeft("Code",fill,10); result+=padLeft("In Store",fill,8); result+=padLeft("Rented Out",fill,8); result+=padLeft("Sold",fill,6); result+=padLeft("For Sale",fill,6); result+=padLeft("For Rent",fill,6); return result; } VideoItem::~VideoItem() { } ************************************************************* VideoStore class **************************************************** #pragma once #include "VideoItem.h" using namespace std; class VideoStore { public: VideoStore(); ~VideoStore(); void run (); void listCommand(); void generateRandItems(int num); void help(); void buy(); void rebuy(); void rent(); void sell(); void report(); void test(); private: VideoItem inventory; }; #include "VideoStore.h" #include "misc.h" #include using namespace std; void VideoStore::run() { string command = ""; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.