Create a Class with the following components. The program requires the following menu and processes: There will be 5 Movie Information in the Linked List. This will be done in the constructor.
The program will require you to design 2 ADTs as described below:
The program will require you to maintain 3 text files with specifications below:
Use a linked list to create a list of videos:
-
Create a separate library for your ADT. You can make necessary adjustments to the given Linked List Project so that it will be able to store the data described. You must have at least the following files:
Implement linked list as described. -
The only exit in the program is the option 8 Quit.
-
Create necessary functions in your main program.
-
Include validations of inputs.
-
Using C++ language
Desired Sample Output:
So far this is the code that I was able to do and it is still incomplete.
Movies.h
#include #include #include using namespace std;
// Data Structure for storing movies class movieList { public: int movieCode; string movieTitle; string movieGenre; string movieProduction; int movieCopies;
movieList(int movieCode, string movieTitle, string movieGenre, string movieProduction ,int movieCopies) { this->movieCode = movieCode; this->movieTitle = movieTitle; this->movieGenre = movieGenre; this->movieProduction = movieProduction; this->movieCopies = movieCopies; } };
class customerList { public: int customerID; string customerName; string customerAddress;
customerList(int customerID, string customerName, string customerAddress) { this->customerID = customerID; this->customerName = customerName; this->customerAddress = customerAddress; } }; // class of movies list class Movies { private: list movies; // list of movies having above DS list customer;
public: // constructor which will show up the menu and will work accordingly Movies() { int option = 8, choice; do {
option = menu(); // taking the option user have input test: switch(option) { case 1: insertMovie(); system("cls"); break;
case 2: deleteMovie(); system("pause"); system("cls"); break;
case 3: appendMovie(); system("pause"); system("cls"); break;
case 4: showMovieDetails(); system("pause"); system("cls"); break;
case 5: printMovieList(); system("pause"); system("cls"); break;
case 6: movieAvailability(); system("pause"); system("cls"); break;
case 7: cout
cout > choice; if(choice == 1) { addCustomer(); system("cls"); break; } if(choice == 2) { detailsCustomer(); system("pause"); system("cls"); break; } if(choice == 3) { //listRented(); system("pause"); system("cls"); break; } else { cout
case 8: quitProgram(); break; default: cout
// Menu having options for what user can do int menu() { cout
cout > option;
return option; }
// Function to insert a movie in movies list void insertMovie() { cout > movieCode;
cout
cout
cout
cout > movieCopies;
// pushing an object of movieList DS created above in list of movies movies.push_back(movieList(movieCode, movieTitle, movieGenre, movieProduction, movieCopies));
return; }
// Function to delete a movie i.e., when user rent a movie void deleteMovie() { char yn; do {
cout > customerID; cout > movieCode;
list :: iterator it; bool movieFound = false; for(it = movies.begin(); it != movies.end(); it++) { if(it->movieCode == movieCode) { movieFound = true; movies.erase(it); cout > yn; }while (yn == 'Y' || yn == 'y'); system("pause"); return; }
// Function to add a movie i.e., when user return the movie void appendMovie() { cout
cout > movieCode;
cout
cout
cout
cout > movieCopies;
movies.push_back(movieList(movieCode, movieTitle, movieGenre, movieProduction, movieCopies));
return; }
// Function to show the details of movie user wants to see void showMovieDetails() { cout > movieCode;
list :: iterator it; bool movieFound = false; for(it = movies.begin(); it != movies.end(); it++) { if(it->movieCode == movieCode) { movieFound = true; cout movieCode; cout movieTitle; cout movieGenre; cout movieProduction; cout movieCopies; cout if(!movieFound) { cout
return; }
// Function to print details of all movies void printMovieList() { list :: iterator it; bool movieFound = false; cout movieCode; cout movieTitle; cout movieGenre; cout movieProduction; cout movieCopies if(!movieFound) { cout
return; }
void movieAvailability() { cout > movieCode; list :: iterator it; bool movieFound = false; for(it = movies.begin(); it != movies.end(); it++) { if(it->movieCode == movieCode) { movieFound = true; cout movieCode; cout movieTitle; cout movieGenre; cout movieProduction; cout movieCode; cout movieTitle; cout movieGenre; cout movieProduction; cout // Function to add cutomer to the list void addCustomer() { cout > customerID;
cout
cout
customer.push_back(customerList(customerID,customerName, customerAddress));
return; }
void detailsCustomer() { cout > customerID;
list :: iterator it; bool customerFound = false; for(it = customer.begin(); it != customer.end(); it++) { if(it->customerID == customerID ) { customerFound = true; cout customerID; cout customerName; cout customerAddress; cout //void listRented();
// Destructor void quitProgram() { movies.clear(); // clear will clear the complete movie list
return; } }; ----------------------------------------------------------
storeManage.cpp
#include "Movies.h" // including the header file we created using namespace std;
int main() { Movies m; // creating an object to call movies constructor
return 0; }
Data Video_ID (preferably int, auto-generated) Movie Title Genre Production Number of Copies Movie Image Filename [1] VIDEO ADT Operations [1] Insert a new video [2] Rent a video, that is, check out a video [3] Return a video, or check in, a video [4] Show the details of a particular video [5] Display all videos in the store [6] Check whether a particular video is in the store [2] CUSTOMER PARENT ADT Data Operations Customer_ID (preferably int, auto-generated) [1] Add Customer Name [2] Show the customer details Address (3] Print list of all customers [3] CUSTOMER-RENT CHILD ADT Customer_ID [1] Rent a Video (Add to the video ids rented) Video_ID (of all rented videos of a customer) [2] Return a Video (Remove the video id from the list) [3] Print list of all videos rented by each customer Text File [1] VIDEO Text File Requirements [1] Will store the information about the Videos [2] Should contain the following by default: 5 Horror Movies 5 Romance Movies 5 Sci-Fi Movies 5 Action Movies 5 Comedy Movies **Must be authentic and true. ** [1] Will store the basic information about the Customers [2] Should contain at least 10 customers by default **Must be authentic and true. ** [1] Will store all customers that RENT A VIDEO [2] Will store all the Video_IDs of all rented videos [3] Will delete Video_IDs and Customer_ID when videos are returned [2] CUSTOMER Text File [3] CUSTOMER-RENT INSTRUCTIONS: The program will have the following options/menus. o (1) New Video o [2] Rent a Video o [3] Return a Video o [4] Show Video Details o [5] Display all Videos o [6] Check Video Availability o [7] Customer Maintenance [1] Add New Customer [2] Show Customer Details [3] List of Videos Rented by a Customer o [8] Exit Program Follow the suggested screen dialogs below for each of the option above [1] NEW VIDEO Video ID: 1 auto-generated Movie Title: Avengers: Endgame user input Genre: Sci-Fi user input Production: Marvel Studios user input Number of Copies: user input Movie Image Filename: c:\endgame.jpg Juser input 10 Press Enter to continue... [2] RENT A VIDEO Customer ID: Name: Address: 1 user input Resty Aldana automatically appears Gen. Trias, Cavite automatically appears Videos to Rent.... Video ID: Movie Title: Number of Copies 1 user input Avengers: Endgame automatically appears 9 automatically appears 9 Rent another Video? Y Video ID: Movie Title: Number of Copies 2 Captain Marvel 3 user input automatically appears automatically appears 3 Rent another Video? N Press Enter to continue... [3] RETURN A VIDEO Customer ID: Name: Address: 1 Resty Aldana Gen. Trias, Cavite user input automatically appears automatically appears Videos Rented.... Video ID: 1 Video ID: 2 Videos successfully returned! Press to continue... Data Video_ID (preferably int, auto-generated) Movie Title Genre Production Number of Copies Movie Image Filename [1] VIDEO ADT Operations [1] Insert a new video [2] Rent a video, that is, check out a video [3] Return a video, or check in, a video [4] Show the details of a particular video [5] Display all videos in the store [6] Check whether a particular video is in the store [2] CUSTOMER PARENT ADT Data Operations Customer_ID (preferably int, auto-generated) [1] Add Customer Name [2] Show the customer details Address (3] Print list of all customers [3] CUSTOMER-RENT CHILD ADT Customer_ID [1] Rent a Video (Add to the video ids rented) Video_ID (of all rented videos of a customer) [2] Return a Video (Remove the video id from the list) [3] Print list of all videos rented by each customer Text File [1] VIDEO Text File Requirements [1] Will store the information about the Videos [2] Should contain the following by default: 5 Horror Movies 5 Romance Movies 5 Sci-Fi Movies 5 Action Movies 5 Comedy Movies **Must be authentic and true. ** [1] Will store the basic information about the Customers [2] Should contain at least 10 customers by default **Must be authentic and true. ** [1] Will store all customers that RENT A VIDEO [2] Will store all the Video_IDs of all rented videos [3] Will delete Video_IDs and Customer_ID when videos are returned [2] CUSTOMER Text File [3] CUSTOMER-RENT INSTRUCTIONS: The program will have the following options/menus. o (1) New Video o [2] Rent a Video o [3] Return a Video o [4] Show Video Details o [5] Display all Videos o [6] Check Video Availability o [7] Customer Maintenance [1] Add New Customer [2] Show Customer Details [3] List of Videos Rented by a Customer o [8] Exit Program Follow the suggested screen dialogs below for each of the option above [1] NEW VIDEO Video ID: 1 auto-generated Movie Title: Avengers: Endgame user input Genre: Sci-Fi user input Production: Marvel Studios user input Number of Copies: user input Movie Image Filename: c:\endgame.jpg Juser input 10 Press Enter to continue... [2] RENT A VIDEO Customer ID: Name: Address: 1 user input Resty Aldana automatically appears Gen. Trias, Cavite automatically appears Videos to Rent.... Video ID: Movie Title: Number of Copies 1 user input Avengers: Endgame automatically appears 9 automatically appears 9 Rent another Video? Y Video ID: Movie Title: Number of Copies 2 Captain Marvel 3 user input automatically appears automatically appears 3 Rent another Video? N Press Enter to continue... [3] RETURN A VIDEO Customer ID: Name: Address: 1 Resty Aldana Gen. Trias, Cavite user input automatically appears automatically appears Videos Rented.... Video ID: 1 Video ID: 2 Videos successfully returned! Press to continue