Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a Video Rental and Sale Store Management Program. Each video record will m

ID: 3628781 • Letter: W

Question

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.

Explanation / Answer

I didn't finish the program as it would be benefitial for you to actually finish it by yourself.

You just need to finish the empty spots

#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;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote