Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem Statement: The imdb.com website is launching a mobile app, and has askedyou to develop a prototype by means of a C++ program that willallow

Problem Statement:

The imdb.com website is launching a mobile app, and has askedyou to develop a prototype by means of a C++ program that willallow a user to query a digital library of movies.

The program must offer the user a menu with the followingoptions:

  1. Display movies sorted by title
  2. Display movies sorted by rating
  3. Lookup title and actors by id
  4. Lookup id by title and either actor
  5. Quit the program

The movie library will contain the following information foreach title:

id (sequence of numbers and/or letters, withoutspaces)

title (may contain spaces in it)

actor1 (may containspaces in it)

actor2 (may containspaces in it)

released (year ofrelease, a whole number)

rating (averagestars from website, from 1 to 10, could have fractional parts)

The program should first read the data from a text file named“library.txt”. This file will contain data for each movie in thelibrary in the order listed above. The id, title, actor1, andactor2 will each be on a separate line. The released and ratingfields will be on the same line. See the sample input file in theassignment email.

The program should be able to store up to 100 different movies.You may assume that the ids will be unique (you do not need tocheck for this).

The program should perform the selected operation from the menuand then re-display the menu.

For the Display operations, display theinformation for each movie on a separate line. The values shouldline up in columns (use setw). The title and actor fields should beleft justified, the remaining data should be right justified.Headers for the table are optional.

For the Lookup operations, label the outputvalues. If the movie is not found, display an appropriate errormessage.

Do not change the menu numbers associated withthe operations.

Additional Requirements:

  1. This program must be done in a Linux or Unixenvironment, using a command line compiler like g++. Do not useCode::Blocks, Eclipse, or Xcode IDEs to compile.
  2. Your program must compile and run, otherwiseyou will receive a grade of 0.
  3. The program must be modular (use top-downdesign), with significant work done by functions.Each function should perform a single, well-defined task.
  4. Use incremental development. Implement one feature at atime.
  5. Use a partially filled array of structures tostore the library:
    Use a counter variable to count the number of items that are readin from the file, and use this value as the size of the array forthe search and sort functions.
  6. Your program should work for an input file with any number ofmovies up to 100.
  7. Use fin >> ws; getline(fin, str); to input a stringon a given line, including spaces, from an input file fin intoa string variable str. This also works for cin.
  8. For option “1. Display movies sorted by title,” sort inascending alphabetical order.
  9. For option “2. Display movies sorted by rating,” if multiplemovies have the same rating, it does not matter which one is listedfirst (or second) within that group. Also, sort indescending order: from 10 down to 1.
  10. For option “3. Lookup title and actors by id,” you MUST usebinary search.
  11. For option “4. Lookup id by title and either actor,” Irecommend linear search.

//**info in library.txt**

A201Avengers: EndgameScarlett JohanssonChris Evans2019 8.6B331Despicable Me 3Steve CarellKristen Wiig2017 6.1D210NeighborsZac EfronRose Byrne2014 6.3Z122Beauty and the BeastEmma WatsonDan Stevens2017 7.2

//Example output**

Menu1. Display movies sorted by title2. Display movies sorted by rating3. Lookup title and actors by id4. Lookup id by title and either actor5. Quit the ProgramEnter your choice: 1Avengers: Endgame    Scarlett Johansson   Chris Evans   2019  8.6Beauty and the Beast Emma Watson          Dan Stevens   2017  7.2Despicable Me 3      Steve Carell         Kristen Wiig  2017  6.1Neighbors            Zac Efron            Rose Byrne    2014  6.3Menu1. Display movies sorted by title2. Display movies sorted by rating3. Lookup title and actors by id4. Lookup id by title and either actor5. Quit the ProgramEnter your choice: 2Avengers: Endgame    Scarlett Johansson   Chris Evans   2019  8.6Beauty and the Beast Emma Watson          Dan Stevens   2017  7.2Neighbors            Zac Efron            Rose Byrne    2014  6.3Despicable Me 3      Steve Carell         Kristen Wiig  2017  6.1Menu1. Display movies sorted by title2. Display movies sorted by rating3. Lookup title and actors by id4. Lookup id by title and either actor5. Quit the ProgramEnter your choice: 4Enter the title: NeighborsEnter either actor: Rose ByrneThe id of Neighbors with Rose Byrne and Zac Efron is D210Menu1. Display movies sorted by title2. Display movies sorted by rating3. Lookup title and actors by id4. Lookup id by title and either actor5. Quit the ProgramEnter your choice: 3Enter the id of the movie: B331The movie with id B331 is: Despicable Me 3Actors:Steve CarellKristen WiigMenu1. Display movies sorted by title2. Display movies sorted by rating3. Lookup title and actors by id4. Lookup id by title and either actor5. Quit the ProgramEnter your choice: 3Enter the id of the movie: C123No movie found with that id.Menu1. Display movies sorted by title2. Display movies sorted by rating3. Lookup title and actors by id4. Lookup id by title and either actor5. Quit the ProgramEnter your choice: 5Thank you for using the imdb.com app.

Step by Step Solution

3.48 Rating (138 Votes )

There are 3 Steps involved in it

Step: 1

include include include include include using namespace std movie structure struct movie string id string title string actor1 string actor2 int released float rating function prototypes void displayMo... 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

Auditing and Assurance services an integrated approach

Authors: Alvin a. arens, Randal j. elder, Mark s. Beasley

14th Edition

133081605, 132575957, 9780133081602, 978-0132575959

More Books

Students also viewed these Programming questions

Question

What is the difference between adsorption and absorption?

Answered: 1 week ago