Write a program that would allow the user to interact with a part of the IMDB movie database

Write a program that would allow the user to interact with a part of the IMDB movie database. Each movie has a unique ID, name, release date, and user rating. You’re given a file containing this information (see movies.txt in “Additional files” section). The first 4 rows of this file correspond to the first movie, then after an empty line 4 rows contain information about the second movie and so forth. Format of these fields: ID is an integer Name is a string that can contain spaces Release date is a string in yyyy/mm/dd format Rating is a fractional number The number of movies is not provided and does not need to be computed. But the file can’t contain more than 100 movies. Then, it should offer the user a menu with the following options: Display movies sorted by id Display movies sorted by release date, then rating Lookup a release date given a name Lookup a movie by id Quit the Program The program should perform the selected operation and then re-display the menu. For options 1 and 2, display the information about each movie on a single, separate line (see sample_execution.txt in downloadable files). First print the header (see “Tips” section) then values that should line up in columns (use setw). For option 3 output the release date and for option 4 output the results for the found movie. For options 3 and 4 if the movie is not found display an appropriate message (see sample_execution.txt in downloadable files). Important: Your output has to match exactly. Implementation details Your program should contain a structure: Movie. Has 4 fields: id – integer number name – a string releaseDate – a string rating – double Important: Don’t change field names/data types or their order. You’ll not be able to pass all tests otherwise. Aside from main your program should have at least 6 functions. void readMovies(ifstream& in, Movie movies[], int& size); // in is a file stream to of “movies.txt” file void displayMovies(Movie movies[], int SIZE); void sortByDateRating(Movie movies[], int SIZE); void sortById(Movie movies[], const int SIZE); int linearSearchByName(Movie movies[], int SIZE, string targetName); int binarySearchById(Movie movies[], int SIZE, int targetId); readMovies. Should read movies into movies array from “in” file stream. Updates size. displayMovies. Should nicely print movies array (see “Tips” section) sortByDateRating. Should sort movies by releaseDate (from older to newer) and if the release dates of two movies are the same they should be ordered by rating in descending order. sortById. Should sort movies by id field in ascending order. linearSearchByName. Should find an index of a movie by its name using a linear search. If no such movie exist return -1. binarySearchById. Should find and index of a movie by its id using a binary search. If no such movie exist return -1.

Looking for a similar assignment? Get help from our qualified experts!

Order Now

Don't use plagiarized sources. Get Your Custom Essay on
Write a program that would allow the user to interact with a part of the IMDB movie database
Just from $8/Page
Order Now