Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objectives: Using linked list to store information Sorting data in linked list Handle input errors and invalid values Design and create a well-structure program using

Objectives:

Using linked list to store information

Sorting data in linked list

Handle input errors and invalid values

Design and create a well-structure program using C++ basic programming constructs

Description:

Write a menu-driven program to keep track of your favorite movies:

MENU A Add a movie U Update a movie E rEmove 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 rEmove 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 rEmove 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 rEmove 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]

Use sequence numbers for 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 rEmove 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]

Requirements:

You decide whether to use C or C++ strings, as long as movie titles can be up to 50 characters long.

Do case-independent sorting, but do not convert case of any input.

You decide upon your rating system -- can be any data type.

The "remove" option should actually remove the node. Use sequence numbering to identify the movie to remove, with the valid range of numbers in the prompt.

You decide what to say, if anything, if there's no match for any of the user's input.

Use a linked list to store the movie information, initially empty.

Add new nodes at the front of the list.

The output table should have nicely-spaced column headings and sequence numbering.

Use blank lines in the output to separate blocks of text as modeled in the sample output above.

Avoid memory leaks as nodes are removed and when the program ends -- use a delete loop.

Hints:

Keeping Track Of The Number Of Nodes

Did you notice the "Which movie to update [1-3]:" prompt? It's not as easy as it looks! What if a node has been removed? Then it's "[1-2]". You'll need a way to keep track of the number of nodes in your list, and a way to put that number in the update and remove prompts. It's not too hard if you think about it and plan it out.

Do not save the sequence number as an attribute of the movie objects!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

4. Describe cultural differences that influence perception

Answered: 1 week ago