Description
Using basic expressions, receiving user input, display values of different data types.
Requirements
- Declare a string called movie_name.
- Declare a string called mpaa_rating.
- Declare int’s called release_year, ratings_count
- Declare double’s called current_rating, user_rating, new_rating
- Declare a char called region
- Ask the user to enter the name of a movie. Use movie_name to receive this from the user. Make sure you allow movie names with spaces.
- Ask the user to enter the MPAA rating. Use mpaa_rating to receive this from the user. (MPAA Rating examples, PG-13, R, PG, etc)
- Ask the user to enter the release year. Use release_year to receive this from the user.
- Ask the user to enter the current ratings score. Use current_rating to receive this from the user
- Ask the user to enter the current number of ratings. Use ratings_count to receive this from the user.
- Ask the user to enter the movie’s region. Use region to receive this from the user. See sample interaction below on what text to display when asking for region.
- Ask the user to enter their own rating score. Use user_rating to receive this from the user.
- Calculate the new rating, using the previous rating score and count. Factor in the user’s new rating. Store this calculated value in new_rating. See below for how to calculate new_rating:
((current_rating * ratings_count) + user_rating) / (ratings_count + 1)
- Display the program’s output as shown in the Sample Interaction below.
DO NOT USE
You may not use any conditional constructs such as the IF statement
Sample Interaction / Output
Enter name of movie: Coming To America Enter MPAA rating: R Enter release year: 1988 Enter current ratings score: 7.5 How many ratings so far? 5 1-US/Canada, 2-Japan/Europe/S.Africa/Middle East, 3-Asia In what region is it available? 1 What would you rate it? 9 Coming To America (1988, R) is available in Region 1 New rating: 7.75
LEGEND
PROGRAM OUTPUT
USER INPUT
FROM INPUT
CATALOG ID: CPP-EXP0005
Print Requirements