Question: Define MovieData Structure The program uses a structure named MovieData to store the following information about a movie: Movie Title Director (name stored in the
Define MovieData Structure The program uses a structure named MovieData to store the following information about a movie: Movie Title Director (name stored in the format: Lastname, Firstname) Year Released (stored in the format: YYYY) Running Time (in minutes) Cost of Production Revenue Generated Profit or Loss (calculated field) Define this structure now. Function readAndCalculate The function readAndCalculate should read the movie data into a vector. Each line of the input file contains the name of the movie, the name of the director, the year of release, running time, cost of production, and revenue generated, with each piece of data separated by a semi-colon (;). There is no sentinel. Example Input File movieData.txt The Lord of the Rings: The Fellowship of the Ring;Jackson, Peter;2001;178;93000000;871530324 Star Wars Episode I: The Phantom Menace;Lucas, George;1999;136;115000000;1027044677 2001: A Space Odyssey;Kubrick, Stanley;1968;142;12000000;190700000 Tron;Lisberger, Steven;1982;96;17000000;33000000 Blade Runner;Scott, Ridley;1982;117;28000000;32868943 D.A.R.Y.L.;Wincer, Simon;1985;99;12000000;7840873 Short Circuit;Badham, John;1986;98;9000000;40697761 WarGames;Badham, John;1983;114;12000000;79568000 The Matrix;The Wachowski Brothers;1999;136;63000000;463517383 Iron Man;Favreau, Jon;2008;126;140000000;585212101
The amount of the movie's profit or loss should be determined after reading the movie's cost of production and the amount of revenue it generated; if there was a loss, the amount stored should be negative.
The code should read the data from the file and calculate the profit/loss, filling a single instance of structure MovieData; this single structure should then be added to the vector of movies. Complete this function now.
Function write The function write should output the information to a file, specified by a file handle via parameter, with all information for a movie on a single line with the pieces of information separated by semi-colons. See the sortedAlpha.txt file provided in the Starter Code section of this assignment for an example of the output.
Function bubbleSortByName The function bubbleSortByName should sort the movies ascending by title. This code should be very similar to the code from the tutorial. Complete this function now.
Function bubbleSortByProfit The function bubbleSortByProfit should sort the movies descending by profit/loss. This code will be identical to the bubbleSortByName code with only the conditional expression controlling the swap changing. Complete this function now.
Function displaySingleMovie The function displaySingleMovie should display the information of a single movie to the screen, with each piece of information on a line by itself. Complete this function now.
Function determineHighestProfitMovie The function determineHighestProfitMovie should determine which movie made the most profit. You may write this function one of two ways: (1) assume the movies have been sorted by profit using the bubbleSortByProfit function or (2) make no assumption as to whether the data has been sorted or not and write code that will work regardless of sorted order. This function should return the structure containing this movie's information.
Expected Result Using movieData.txt File The output of your program should look exactly like this. Data values may differ.
Movie with highest profit: Star Wars Episode I: The Phantom Menace
Directed by Lucas, George Released in 1999
Running 36 minutes
Cost $115,000,000.00 to produce
Generated $1,027,044,677.00 in revenue
For a profit of $912,044,677.00
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
