Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that reads information about movies from a file named movies.txt. Each line of this file contains the name of a movie, the

Write a program that reads information about movies from a file named movies.txt. Each line of this file contains the name of a movie, the year the movie was released, and the revenue for that movie. Your program reads this file and stores the movie data into a list of movies. It then sorts the movies by title and prints the sorted list. Finally, your program asks the user to input a title and the program searches the list of movies and prints the information about that movie. To represent the movie data you have to create a struct named Movie with three members: title, yearReleased, and revenue. To handle the list of movies you have to create an array of Movie structs named topMovies capable of storing up to 20 movies. Your solution must be implemented using the following functions: storeMoviesArray(ifstream inFile, Movies topMovies[], const int SIZE) // This function receives the input file, the movies array, and the size of the // array. // It reads from the file the movie data and stores it in the array. // Once all the data has been read in, it returns the array with the information // of the movies. sortMoviesTitle(Movie topMovies[], const int SIZE) // This function receives the movies array and the size of the array and sorts // the array by title. It returns the sorted array. printMoviesArray(Movie topMovies[], const int SIZE) // This function receives the movies array and the size of the array and prints // the list of movies. findMovieTitle(Movie topMovies[],const int SIZE, string title) // This function receives the movies array, the size of the array, and the title // of the movie to be searched for. // It returns the index of the array where the title was found. If the title was // not found, it returns -1. It must use binary search to find the movie. main() // Takes care of the file (opens and closes it). // Calls the functions and asks whether to continue. IMPORTANT: ? You must define whether the provided functions are a void or a value-returning function. You CANNOT add or remove functions. ? You must define whether the provided parameters are a value parameter or a reference parameter. You CANNOT add or remove parameters. ? You must use the identifiers I provide for the parameters and functions. ? Assume the input file will always have exactly 20 movies. Note: all the functions except main() must be defined in a header file named hw5functions.h image text in transcribedimage text in transcribed MUST BE IN C++ LANGUAGE!!!!!!!!!!!

Movie title Year Revenue AliceInWonderland 2010 S 334191110 Avatar 2010 $ 408392727 Avengers :AgeofUltron 2015 $1405413868 DespicableMe 2010 $ 251203225 Furious7 2015 $1516045911 HarryPotterAndThe DeathlyHallows PartI 2010 $ 283533215 HowToTrainYourDragon 2010 217581231 Inception 2010 $ 292568851 InsideOut 2015 S 857611174 I ronMan2 2010 312433331 JurassicWorld 2015 $1670400637 Minions 2015 $1159398397 Mission: ImpossibletRogueNation 2015 S 682330139 ShrekForeverAfter 2010 238736787 Spectre 2015 $ 880674609 StarWars :TheForceAwakens 2015 $2068223624 TheHungerGames Mockingjay 2015 653428261 TheMartian 2015 630161890 TheTwilightSagaEclipse 2010 S 300531751 oyStory3 2010 415004880 Enter a movie title: Avatarr Title: Avatar ear Released 2010 Revenue $408392727 Do you want to continue? y>

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

More Books

Students also viewed these Databases questions

Question

What are the objectives of job evaluation ?

Answered: 1 week ago

Question

Write a note on job design.

Answered: 1 week ago

Question

Compute the derivative of f(x)cos(-4/5x)

Answered: 1 week ago

Question

Discuss the process involved in selection.

Answered: 1 week ago