Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Construct a menu-driven C++ program to trackyour favorite movies using a linked list stack . Name the CPP as you wish. It should work something
Construct a menu-driven C++ program to trackyour favorite movies using a linked liststack. Name the CPP as you wish. It should work something like this:
MENU A Add a movie U Update a movie E Erase a movie L List all movies T arrange by Title V arrange by year Viewed R arrange by Rating Q Quit ...your choice: a[ENTER] Enter a movie's name: Star Wars[ENTER] Enter the year you saw Star Wars [like 2016]: 1977[ENTER] Enter your rating for Star Wars [1, 2, 3, 4, 5]: 1[ENTER] MENU A Add a movie U Update a movie E Erase a movie L List all movies T arrange by Title V arrange by year Viewed R arrange by Rating Q Quit ...your choice: a[ENTER] Enter a movies' name: Mission Impossible[ENTER] Enter the year you saw Mission Impossible [like 2016]: 2015[ENTER] Enter your rating for Mission Impossible [1, 2, 3, 4, 5]: 2[ENTER] MENU A Add a movie U Update a movie E Erase a movie L List all movies T arrange by Title V arrange by year Viewed R arrange by Rating Q Quit ...your choice: L[ENTER] # Title Viewed Rating -- --------------------------- ------ ------ 1 Mission Impossible 2015 2 2 Star Wars 2016 1 MENU A Add a movie U Update a movie E Erase a movie L List all movies T arrange by Title V arrange by year Viewed R arrange by Rating Q Quit ...your choice: q[ENTER]
Requirements
- You decide whether to useC or C++ strings,as long asmovie titlescan beup to 50characterslong.
- Use dynamic memory to allocate nodes for the linked list.
- The rating system should be between integer 1 to 5.
- The "remove" option should actuallyremovethe node. Usesequence numberingto identify the movie to remove, with the valid range of numbers in the prompt.
- You decide what to say, if anything, if there'sno matchforanyof theuser's input.
- Use alinked listto store the movie information, initially empty.
- Add new nodes at thefrontof the list.
- The output table should have nicely-spacedcolumn headingsand sequence numbering.
- Useblank linesin the output to separate blocks of text as modeled in the sample output above.
- Apply serialization to a TXT file namedmovies.txtbefore terminating the program. There is no need to serialize up at the beginning of the program.
- Print the updated list when an arrangement is made.
- Avoid memory leaks as nodes are removed and when the program ends -- use adeleteloop.
Usesequence numbersfor the "remove" and "update"options, like this:
# Title Viewed Rating -- --------------------------- ------ ------ 1 Mission Impossible 2015 2 2 Star Wars 2016 1 MENU A Add a movie U Update a movie E Erase a movie L List all movies T arrange by Title V arrange by year Viewed R arrange by Rating Q Quit ...your choice: E[ENTER] ...which movie to remove (1-2)? 2[ENTER]
That is,show the full range of valid sequence number choices, exactly as in the previous lab assignment. This is to show that you can eitherkeep track of, orcount, the number of nodes in a linked list.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started