Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE TAKE SCREENSHOT Header File (.h file) Implementation File (.cpp) Main Program (.cpp) Show sample output for each operation. Show adequate outputs to demonstrate how

PLEASE TAKE SCREENSHOT

Header File (.h file) Implementation File (.cpp)

Main Program (.cpp) Show sample output for each operation. Show adequate outputs to demonstrate how your program works.

PLEASE HELP ME COMPLETE THE CODE

#include #include #include

using namespace std;

// Data Structure for inserting movies class movieList { public: int movieCode; string movieTitle; string movieGenre; int yearReleased;

movieList(int movieCode, string movieTitle, string movieGenre, int yearReleased) { this->movieCode = movieCode; this->movieTitle = movieTitle; this->movieGenre = movieGenre; this->yearReleased = yearReleased; } };

// class of movies list class moviesLL { private: list movies; // list of movies going to have above Data Structure

public: // constructor which will show up the menu and will work accordingly moviesLL() { int option = 5; do { option = menu(); // taking the option user have input

switch(option) { case 1: insertMovie(); break;

case 2: deleteMovie(); break;

case 3: appendMovie(); break;

case 4: showMovieDetails(); break;

case 5: printMovieList(); break;

case 6: quitProgram(); break;

default: cout } } while(option != 6); // this option is for quitting the program }

// Menu of what the user can do int menu() { cout\"> cout\"> cout cout cout cout cout cout cout

cout int option; cin >> option;

return option; }

// Function to input a movie in movies list void insertMovie() { cout int movieCode; cin >> movieCode;

cout string movieTitle; cin.ignore(); getline(cin, movieTitle);

cout string movieGenre; cin.ignore(0); getline(cin, movieGenre);

cout int yearReleased; cin >> yearReleased;

// pushing an object of movieList Data Structure created above in list of movies movies.push_back(movieList(movieCode, movieTitle, movieGenre, yearReleased));

return; }

// Function to delete a movie i.e., when user rent a movie void deleteMovie() { cout int movieCode; cin >> 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 break; } }

if(!movieFound) { cout }

return; }

// Function to add a movie i.e., when user return the movie void appendMovie() { cout

cout int movieCode; cin >> movieCode;

cout string movieTitle; cin.ignore(); getline(cin, movieTitle);

cout string movieGenre; cin.ignore(); getline(cin, movieGenre);

cout int yearReleased; cin >> yearReleased;

movies.push_back(movieList(movieCode, movieTitle, movieGenre, yearReleased));

return; }

// Function to show the details of movie user wants to see void showMovieDetails() { cout string movieTitle; cin.ignore(); getline(cin, movieTitle);

list :: iterator it; bool movieFound = false; for(it = movies.begin(); it != movies.end(); it++) { if(it->movieTitle == movieTitle) { movieFound = true; cout cout movieCode; cout movieTitle; cout movieGenre; cout yearReleased; break; } }

if(!movieFound) { cout }

return; }

// Function to print details of all movies void printMovieList() { list :: iterator it; bool movieFound = false; cout for(it = movies.begin(); it != movies.end(); it++) { movieFound = true; cout movieCode; cout movieTitle; cout movieGenre; cout yearReleased; }

if(!movieFound) { cout }

return; }

// Destructor void quitProgram() { movies.clear(); // will clear the complete movie list

return; } };

int main() { moviesLL m; // creating an object to call constructor

return 0; }

Create a MovieList Class with the following components:

  • Movie Code
  • Movie Title
  • Movie Genre
  • Year Released

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.

  1. Insert a New Movie (insert operation)
  2. Rent a Movie (delete operation)
  3. Return a Movie (append operation)
  4. Show Movie Details (traversal operation with match Movie Code)
  5. Print Movie List (traversal operation)
  6. Quit the Program (destructor)

Use a linked list to create a list of videos:

  • Create a separate library for your MovieList 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 6 Quit.
  • Create necessary functions in your main program.
  • Include validations of inputs.
  • Specify the group member in-charge of the codes by indicating his name as comments.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Entrepreneurship

Authors: Andrew Zacharakis, William D Bygrave

5th Edition

1119563097, 9781119563099

More Books

Students also viewed these Programming questions

Question

1. Administrative routines, such as taking attendance

Answered: 1 week ago