Write a complete C program determine whether a movie is recommended to watch or not based on user input.
Write a complete C program based on the above situation and the following instructions. i. Declare a
structure
of movie record called
MovieRecord
that has:
∙ Movie title :
title (string)
∙ Movie year :
year (int)
∙ Movie rating :
rating (float)
∙ Movie recommendation :
recommend (string)
- In main()
∙ Create a structure variable array called
movie
that can store 3 movie records. ∙ Call
getUserDetails()
to get the details of the user.
∙ Call
getMovieRatings()
and pass in the structure array movie as argument. ∙ Calculate the average rating of the movies. Set average rating as global variable. ∙ Call
getRecommendation()
and pass in the record of each movie as reference. ∙ Finally, display the details as per sample output.
iii. In
getUserDetails()
∙ Get the name and user ID of the user.
- In
getMovieRatings()
∙ Get the movie title, movie year, and movie rating from the user.
o If movie rating entered by user is out of range, ask user to re-enter the movie rating.
∙ Calculate the total ratings of the movies and return back the value.
v.
In
getRecommendation()
∙ Identify whether it is recommended to watch the movie or not based on the average rating.
Sample Output :
Extracted text: User Registration Name : James Tan User ID : JT1010 Movie Ratings Movie Title : The Rope Curse 2 Movie Year : 2020 Rating (0-5) : 3.98 Movie Title : 6 Underground Movie Year : 2019 Rating (0-5) : -9 Rating out of range. Rating (0-5) 20 Rating out of range. Rating (0-5) : 4.5 Movie Title : The King Movie Year : 2019 Rating (0-5) : 2.1 You have given an average rating of 3.53 Movie Summary The Rope Curse 2 - RECOMMENDED 6 Underground The King RECOMMENDED NOT RECOMMENDED