Can you complete the highlighted areas thanks. Here are the instructions: Can yo
ID: 3628964 • Letter: C
Question
Can you complete the highlighted areas thanks.
Here are the instructions:
Can you please write the code ASAP. Mine still doesn't work. I need all requirements mets. Life saver rating awarded. Thanks.
Write a Video Rental and Sale Store Management Program. 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. The program will accept the following commands listed below:
a) HELP will list the commands.
b) QUIT will end the program.
c) 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.)
d) 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.)
e) 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 message saying "no videos are currently available".
f) 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 message saying that "no videos are currently available".
g) 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.
h) 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.
Here is the code with the missing functions that i need. Thx
#include <iostream>
#include <list>
#include <string>
using namespace std;
/***************************************************************************
* Video Class
**************************************************************************/
class Video
{
private:
string name; // name
int codeNum; // unique code number
int quanByStore; // quantity by store
int quanRent; // quantity rented
int quanSold; // quantity sold
public:
Video(); // default constructor
Video(string, int, int);
~Video();
string getName();
int getCodeNum();
int getQuanByStore();
void setQuanByStore(int);
int getQuanRent();
void setQuanRent(int);
int getQuanSold();
void setQuanSold(int);
};
Video::Video()
{
name = "";
codeNum = 0;
quanByStore = 0;
quanRent = 0;
quanSold = 0;
}
Video::Video(string n, int cNum, int qByStore)
{
name = n;
codeNum = cNum;
quanByStore = qByStore;
quanRent = 0;
quanSold = 0;
}
Video::~Video()
{
// do nothing
}
string Video::getName()
{
return name;
}
int Video::getCodeNum()
{
return codeNum;
}
int Video::getQuanByStore()
{
return quanByStore;
}
void Video::setQuanByStore(int q)
{
quanByStore = q;
}
int Video::getQuanRent()
{
return quanRent;
}
void Video::setQuanRent(int q)
{
quanRent = q;
}
int Video::getQuanSold()
{
return quanSold;
}
void Video::setQuanSold(int q)
{
quanSold = q;
}
/****************************************************************************
* Manager Class
***************************************************************************/
class Manager
{
private:
list<Video> inventory;
public:
Manager(); // constructor
~Manager(); // destructor
void prompt();
void listCommand();
void buy();
void rebuy();
void rent();
void sell();
void report();
void test();
};
Manager::Manager()
{
//clear inventory
inventory.clear();
}
Manager::~Manager()
{
// clear inventory
inventory.clear();
}
void Manager::prompt()
{
string command;
cout << "Enter a command: ";
cin >> command;
while (command != "QUIT")
{
if (command == "HELP")
listCommand();
else if (command == "BUY")
buy();
else if (command == "REBUY")
rebuy();
else if (command == "RENT")
rent();
else if (command == "SELL")
sell();
else if (command == "REPORT")
report();
else if (command == "TEST")
test();
else
cout << "** Not a valid command **" << endl;
cout << "Enter a command: ";
cin >> command;
}
}
void Manager::listCommand()
{
cout << "-----------" << endl;
cout << "Valid commands are: "<< endl;
cout << " HELP - list the commands" << endl;
cout << " QUIT - end the program" << endl;
cout << " BUY - add new item to inventory " << endl;
cout << " REBUY - add more existing item to inventory" << endl;
cout << " RENT - rent a video" << endl;
cout << " SELL - sell a video" << endl;
cout << " REPORT - display a list of all the videos" << endl;
cout << " TEST - generate 10 random videos" << endl << endl;
}
void Manager::buy()
{
string name;
int code;
int quantity;
cout << "----------" << endl;
cout << "Enter video's name: ";
cin >> name;
cout << "Enter the code: (integer) ";
cin >> code;
cout << "Enter the quantity: ";
cin >> quantity;
// create a video object
Video newVideo(name, code, quantity);
// add the video to inventory
inventory.push_back(newVideo);
cout << "[video saved]" << endl;
cout << endl;
}
void Manager::rebuy()
{
}
void Manager::rent()
{
}
void Manager::sell()
{
}
void Manager::report()
{
list<Video>::iterator it;
for (it=inventory.begin(); it!=inventory.end(); it++)
{
Video targetVideo = *it;
cout << "----------" << endl;
cout << "Name: " << targetVideo.getName() << endl;
cout << "Code: " << targetVideo.getCodeNum() << endl;
cout << "Quantity by store: " << targetVideo.getQuanByStore()<<endl;
cout << "Quantity rent: " << targetVideo.getQuanRent() << endl;
cout << "Quantity sold: " << targetVideo.getQuanSold() << endl;
cout << endl;
}
}
void Manager::test()
{
}
int main()
{
Manager storeManager;
storeManager.prompt();
return 0;
}
Explanation / Answer
Hi try with the following,this will help u for your code. #ifndef "VIDEO_H" 002 #define "VIDEO_H" 003 #include 004 #include 005 using namespace std; 006 007 class video 008 { public: 009 const static int actor=2; 010 const static int size=1; 011 video(); 012 void setVideo(); 013 void getVideo(); 014 void count(int); 015 void date(int,int,int); 016 void disDate(); 017 018 private: 019 string title; 020 string director; 021 int yearProduced; 022 int number; 023 string mainActors[actor]; 024 int day; 025 int month; 026 int year; 027 028 }; 029 #endif 030 031 032 video::video() 033 { 034 yearProduced=day=month=year=0; 035 036 } 037 038 039 void video::setVideo() 040 { 041 for(int a=0;aRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.