Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A straightforward C++ program really really really needs HELP PLZ! ------------------------------------------------------------------------------------------------------------- Background In this program, you will be developing a simple program to process movie

A straightforward C++ program really really really needs HELP PLZ!

-------------------------------------------------------------------------------------------------------------

Background

In this program, you will be developing a simple program to process movie entries stored in a text file. Your program should enable the user to search the database and print relevant movie information. See sample outputs for commands and options.

Data file format

The supplied movies_db.txt has a space-separated data in the following columnar format:

moveID "Title" year "Genres" ImdbID Rating #Raters

image text in transcribed

---------------------------------------------------------------------------------------------------------------

Here is the content of movies_db.txt:

# moveID "Title" year "Genres" ImdbID Rating #Raters

102125 "Iron Man 3" 2013 "Action|Sci-Fi|Thriller|IMAX" 1300854 3.5625 32

193587 "Bungo Stray Dogs: Dead Apple" 2018 "Action|Animation" 8391976 3.5 1

193583 "No Game No Life: Zero" 2017 "Animation|Comedy|Fantasy" 5914996 3.5 1

193581 "Black Butler: Book of the Atlantic" 2017 "Action|Animation|Comedy|Fantasy" 5476944 4 1

193579 "Jon Stewart Has Left the Building" 2015 "Documentary" 5342766 3.5 1

193573 "Love Live! The School Idol Movie" 2015 "Animation" 3837248 4 1

174053 "Black Mirror: White Christmas" 2014 "Drama|Horror|Mystery|Sci-Fi|Thriller" 3973198 4.75 4

112515 "Babadook, The" 2014 "Drama|Horror|Thriller" 2321549 4.5 3

130052 "Clown" 2014 "Drama|Horror" 1780798 3.5 1

193571 "Silver Spoon" 2014 "Comedy|Drama" 3110014 4 1

190215 "Liquid Truth" 2017 "Drama" 7293380 1.5 1

190207 "Tilt" 2011 "Drama|Romance" 1680019 1.5 1

190183 "The Darkest Minds" 2018 "Sci-Fi|Thriller" 4073790 3.5 1

174053 "Black Mirror: White Christmas" 2014 "Drama|Horror|Mystery|Sci-Fi|Thriller" 3973198 4.75 4

130052 "Clown" 2014 "Drama|Horror" 1780798 3.5 1

102007 "Invincible Iron Man, The" 2007 "Animation" 903135 3 1

189547 "Iron Soldier" 2010 "Action|Sci-Fi" 1665744 1 1

189333 "Mission: Impossible - Fallout" 2018 "Action|Adventure|Thriller" 4912910 3.75 2

77561 "Iron Man 2" 2010 "Action|Adventure|Sci-Fi|Thriller|IMAX" 1228705 3.51064 47

188797 "Tag" 2018 "Comedy" 2854926 4 1

188675 "Dogman" 2018 "Crime|Drama" 6768578 3.5 1

1 "Toy Story" 1995 "Adventure|Animation|Children|Comedy|Fantasy" 114709 3.92093 215

167296 "Iron Man" 1931 "Drama" 22002 0.5 1

142056 "Iron Man & Hulk: Heroes United" 2013 "Action|Adventure|Animation" 3221698 3 1

59315 "Iron Man" 2008 "Action|Adventure|Sci-Fi" 371746 3.82447 94

2035 "Blackbeard's Ghost" 1968 "Children|Comedy" 62737 3.66667 3

112326 "Nick Fury: Agent of S.H.I.E.L.D." 1998 "Action|Sci-Fi" 119781 1 1

8462 "Executive Suite" 1954 "Drama" 46963 3 1

170813 "Baywatch" 2017 "Action|Comedy" 1469304 3 3

--------------------------------------------------------------------------------------------------------------------

The program absolutely must be organized into the following 3 classes:

File name Description
Movie.h

The header file to define a class called Movie with suitable instance variables to encapsulate the 7 fields for each Movie as listed in Data file format. This file must have:

1. Constructor 2. Destructor 3. Stream-insertion operator 4. Stream-extraction operator 5. A to_string method

Movie.cpp The source file that implements the methods associated with the Movie class
homework3.cpp This class must contain all the necessary logic associated with loading, finding, searching movies as discussed below. This file must use an std::unordered_map to manage movie entries.

Functionality

The program for this homework must have the following functionality: 1. The program should load data from a fixed "./movies_db.txt" (exactly that path) file into an unordered_map. 2. The program should repeatedly obtain commands from the user (via std::cin) and perform the following operations :

Cmd Example Description
find find 1 Prints information about the movie with given id. If id was not found it prints a suitable message (see sample outputs)
search "terms" search "Iron Man" search "Horror|Mystery|Sci-Fi" Prints all movies with the given search term (i.e., sub-string) if it occurs anywhere in the movie entry. The program should also print the count of matching movies
exit exit The program should stop operating

Note: You may assume the commands entered by the user will be in correct format. Hence, reading commands is simple using std::quoted and std::cin >> x, style of input. Do not overcomplicate command processing.

Sample outputs :

User inputs are shown in bold

Enter a command:

find 223322

Move with ID 223322 not found in database.

Enter a command:

search "Iron Man"

59315 "Iron Man" 2008 "Action|Adventure|Sci-Fi" 371746 3.82447 94

167296 "Iron Man" 1931 "Drama" 22002 0.5 1

142056 "Iron Man & Hulk: Heroes United" 2013 "Action|Adventure|Animation" 3221698 3 1

102125 "Iron Man 3" 2013 "Action|Sci-Fi|Thriller|IMAX" 1300854 3.5625 32

77561 "Iron Man 2" 2010 "Action|Adventure|Sci-Fi|Thriller|IMAX" 12287053.51064 47

102007 "Invincible Iron Man, The" 2007 "Animation" 903135 3 1

Found 6 matche(s).

Enter a command:

search "2014 "Drama|Horror"

174053 "Black Mirror: White Christmas" 2014 "Drama|Horror|Mystery|Sci-Fi|Thriller" 3973198 4.75 4

112515 "Babadook, The" 2014 "Drama|Horror|Thriller" 2321549 4.5 3

130052 "Clown" 2014 "Drama|Horror" 1780798 3.5 1

Found 3 matche(s).

Enter a command:

find 193573

193573 "Love Live! The School Idol Movie" 2015 "Animation" 3837248 4 1

Enter a command:

exit

Col Num Name Datatype int std: :string |A double-quoted title for the movie int std::stringA double-quoted list of genres for the movie int float Description Unique ID for a movie The vear when the movie was released 1moveID title 3 Year 4 genres 5imdbId The IMDB identifier for the movies An average movie rating (assigned by many reviewers Number of reviewers who contributed to ratin 6rating 7numRaters int Note: The first line of the file is a comment-line. Read and ignore this line prior to processing entries from this file Col Num Name Datatype int std: :string |A double-quoted title for the movie int std::stringA double-quoted list of genres for the movie int float Description Unique ID for a movie The vear when the movie was released 1moveID title 3 Year 4 genres 5imdbId The IMDB identifier for the movies An average movie rating (assigned by many reviewers Number of reviewers who contributed to ratin 6rating 7numRaters int Note: The first line of the file is a comment-line. Read and ignore this line prior to processing entries from this file

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

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

Students also viewed these Databases questions

Question

Describe in deep terms what purchasing behaviour is.

Answered: 1 week ago

Question

in writing

Answered: 1 week ago