Question: This will be coded in x 8 6 with Irvine Library For this assignment, you will build a very simple movie review system which uses
This will be coded in x with Irvine Library For this assignment, you will build a very simple movie review system which uses structures and macros.
Create a macro named getIntWithRange which has three parameters: a string prompt, a lower bound, and an upper bound. In the macro, print the string prompt and then retrieve an integer from the user. If the number is below the lower bound or above the upper bound, print an error message and ask for another number. Otherwise, return the entered number in EAX.
Create a structure named Movie with a string field for the movie's name, a word field for the movie's length in minutes and a index doubleword array named reviews, with each index initialized to
In the reviews array, index represents how many star reviews this movie has received, index represents how many star reviews this movie has received, etc.
In the data segment, create an array of Movie objects named AllMovies, with each index containing an uninitialized Movie object. This is a partially filled array, so add a byte variable named numMovies to track how many movies are in the array.
In your main procedure, ask the user for information for the first movie in the array:
The movie's name.The movie's length.
Use the getIntWithRange macro to ensure the length is in between and
Next, build a menubased system which gives the user the following options:
Add a movie: If the user chooses this option, ask them for a movie name and length as before, use getIntWithRange passing and Assign these to the first empty Movie object in the array.Rate a movie: If the user chooses this option, ask them to enter a movie name. Pass the string they input to a procedure named reviewMovie. In this procedure:
See if the movie exists in the array. If it does not, print that it is not found and return. Otherwise:Ask the user how many stars they want to give the movie.
Use the getIntWithRange macro to ensure the rating they enter is in between and
Update the corresponding index in the Movie object's reviews array ie if the user enters increment index
Get average rating. If the user chooses this option, ask them to enter a movie name. Pass the string they input to a procedure named seeAverage. In this procedure:
See if the movie exists in the array. If it does not, print that it is not found and return. Otherwise:Calculate the average star rating for this movie and display it Note: Since we did not cover floating point values, this average value will be an integer. That is okay!
See all movies. If the user chooses this option, pass the array to a procedure named printMovies. The information for each movie in the array should print movie title, length, and number of reviews for each star valueQuit
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
