Write a inventory program that will manage an inventory of videos owned by the s
ID: 3630949 • 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 (no blanks), 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 to your program. 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:
0000146 John Doe 555-555-5555
0000002 Road Trip
0008523 Wine Tasting for Dummies
0007412 Jane Doe 210-555-5555
0008523 Wine Tasting For Dummies
0008745 Jaws
0002548 John Smith 718-555-5555
0009874 Mary Poppins 866-555-5555
0008523 Wine Tasting For Dummies
0008745 Jaws
O) The RENT command from the original assignment one will be modified to also prompt the user for the ID
number of the renter. It will do everything that it did before but 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 new 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
Dear Friend here is the files for the program PLEASE RATE 1)LINKEDLIST.H #ifndef H_LinkedListType #define H_LinkedListType #include #include using namespace std; template struct nodeType { Type info; nodeType *link; }; template class linkedListType { friend ostream& operatorinfo; //return the info of the first node }//end front template Type linkedListType::back() { assert(last != NULL); return last->info; //return the info of the first node }//end back template bool linkedListType::search(const Type& searchItem) { nodeType *current; //pointer to traverse the list bool found; current = first; //set current to point to the //first node in the list found = false; //set found to false while(current != NULL && !found) //search the list if(current->info == searchItem) //the item is found found = true; else current = current->link; //make current point //to the next node return found; }//end search template void linkedListType::insertFirst(const Type& newItem) { nodeType *newNode; //pointer to create the new node newNode = new nodeType; //create the new node assert(newNode != NULL); //If unable to allocate memory, //terminate the program newNode->info = newItem; //store the new item in the node newNode->link = first; //insert newNode before first first = newNode; //make first point to the //actual first node count++; //increment count if(last == NULL) //if the list was empty, newNode is also //the last node in the list last = newNode; } template void linkedListType::insertLast(const Type& newItem) { nodeType *newNode; //pointer to create the new node newNode = new nodeType; //create the new node assert(newNode != NULL); //If unable to allocate memory, //terminate the program newNode->info = newItem; //store the new item in the node newNode->link = NULL; //set the link field of newNode //to NULL if(first == NULL) //if the list is empty, newNode is //both the first and last node { first = newNode; last = newNode; count++; //increment count } else //the list is not empty, insert newNode after last { last->link = newNode; //insert newNode after last last = newNode; //make last point to the actual last node count++; //increment count } }//end insertLast template void linkedListType::deleteNode(const Type& deleteItem) { nodeType *current; //pointer to traverse the list nodeType *trailCurrent; //pointer just before current bool found; if(first == NULL) //Case 1; list is empty. cerrlink; count--; if(first == NULL) //list has only one node last = NULL; delete current; } else //search the list for the node with the given info { found = false; trailCurrent = first; //set trailCurrent to point to //the first node current = first->link; //set current to point to the //second node while(current != NULL && !found) { if(current->info != deleteItem) { trailCurrent = current; current = current->link; } else found = true; } // end while if(found) //Case 3; if found, delete the node { trailCurrent->link = current->link; count--; if(last == current) //node to be deleted was //the last node last = trailCurrent; //update the value of last delete current; //delete the node from the list } else coutlink = newNode; //attach newNode after last last = newNode; //make last point to //the actual last node current = current->link; //make current point to //the next node }//end while }//end else }//end copyList //copy constructor template linkedListType::linkedListType (const linkedListType& otherList) { first = NULL; copyList(otherList); }//end copy constructor //overload the assignment operator template const linkedListType& linkedListType::operator= (const linkedListType& otherList) { if(this != &otherList) //avoid self-copy copyList(otherList); return *this; } #endif 2) #ifndef H_VideoLinkedListType #define H_VideoLinkedListType #include #include #include "linkedList.h" #include "videoType.h" using namespace std; class videoListType: public linkedListType { public: bool videoSearch(string vTitle); //Function to search the list to see whether a //particular title, specified by the parameter title, //is in the store. //Postcondition: Returns true if the title is found; // otherwise, returns false. bool isVideoAvailable(string vTitle); //Function to return true if at least one copy of a //particular video is in the store. void videoCheckOut(string title); //Function to check out a video, that is, rent a video. //Postcondition: copiesInStock is decremented by one. void videoCheckIn(string vTitle); //Function to check in a video returned by a customer. //Postcondition: copiesInstock is incremented by one. bool videoCheckTitle(string vTitle); //Function to determine whether a particular video is in //the store. //Postcondition: Returns true if the video title is the // same as vTitle; otherwise, returns // false. void videoUpdateInStock(string vTitle, int num); //Function to update the number of copies of a video //by adding the value of the parameter num. The //parameter vTitle specifies the name of the video for //which the number of copies is to be updated. //Postcondition: copiesInStock = copiesInStock + num void videoSetCopiesInStock(string vTitle, int num); //Function to reset the number of copies of a video. //The parameter vTitle specifies the name of the video //for which the number of copies is to be reset; the //parameter num specifies the number of copies. //Postcondition: copiesInStock = num void videoPrintTitle(); //Function to print the titles of all the videos in the store. private: void searchVideoList(string vTitle, bool& found, nodeType* ¤t); //Function to searche the video list for a particular //video, specified by the parameter vTitle. //Postcondition: If the video is found, the parameter // found is set to true; otherwise, it is set // to false. The parameter current points to // the node containing the video. }; #endif 3) #include #include #include "videoLinkedListType.h" using namespace std; bool videoListType::isVideoAvailable(string vTitle) { bool found; nodeType *location; searchVideoList(vTitle, found, location); if(found) found = (location->info.getNoOfCopiesInStock() > 0); else found = false; return found; } void videoListType::videoCheckIn(string vTitle) { bool found = false; nodeType *location; searchVideoList(vTitle, found, location); if(found) location->info.checkIn(); else 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.