Movie Rating Program Update

START
TotalStars = 0 // To accumulate the sum of ratings
NumberOfRatings = 0 // To count the total number of valid ratings

WHILE TRUE
PRINT “Please enter a star rating for the featured movie (0-4 stars). Enter a negative number to quit:”
Rating = int(input()) // Get the user’s rating

IF Rating = 0 AND Rating 0 THEN
AverageRating = TotalStars / NumberOfRatings // Calculate the average rating
PRINT “Average star rating for the movie: “, AverageRating
ELSE
PRINT “No ratings were entered.”
END IF

END

B. Modify the movie-rating program so that a user gets three tries to enter a valid rating. After three incorrect entries, the program issues an appropriate message and continues with a new user.

Here’s your modified movie-rating program with a three-attempt limit for invalid entries before prompting a new user:
{“name”: “movie_rating_validation”, “type”: “code/python”, “content”: “TotalStars = 0 # To accumulate the sum of ratingsnNumberOfRatings = 0 # To count the total number of valid ratingsnnwhile True:n print(“Please enter a star rating for the featured movie (0-4 stars). Enter a negative number to quit:”)n attempts = 0 # Counter for invalid attemptsn n while attempts < 3:n try:n Rating = int(input()) # Get the user's ratingn if Rating < 0:n break # Exit the loop if a negative number is entered (manager quits)n elif 0 <= Rating <= 4:n TotalStars += Rating # Add the rating to the totaln NumberOfRatings += 1 # Increment the valid rating countn break # Exit the retry loop on a valid inputn else:n print("Invalid rating. Please enter a value between 0 and 4.")n attempts += 1n except ValueError:n print("Invalid input. Please enter a numeric value between 0 and 4.")n attempts += 1n n if attempts == 3:n print("Too many invalid attempts. Moving to the next user…")n n if Rating 0:n AverageRating = TotalStars / NumberOfRatings # Calculate the average ratingn print(“Average star rating for the movie:”, AverageRating)nelse:n print(“No ratings were entered.”)”}
Successfully created text document ‘Movie Rating Validation’ which will be referenced in all future messages with the unique identifier textdoc_id: ’67d6bcd4b6e881919ee72ca5f696cbb8′
This version allows users three attempts to enter a valid rating before moving on to the next user. If they fail three times, the program notifies them and prompts for a new rating. Let me know if you need any refinements!
Is this pseudocode?

No, this is actual Python code. If you need it in pseudocode with C++ symbols where possible, here’s a revised version:

“`plaintext
START
TotalStars ← 0 // To accumulate the sum of ratings
NumberOfRatings ← 0 // To count the total number of valid ratings

WHILE TRUE DO
PRINT “Please enter a star rating for the featured movie (0-4 stars). Enter a negative number to quit:”
Attempts ← 0 // Counter for invalid attempts

WHILE Attempts < 3 DO
TRY
Rating ← int(input()) // Get the user's rating
IF Rating < 0 THEN
BREAK // Exit the loop if a negative number is entered (manager quits)
ELSE IF Rating ≥ 0 ∧ Rating ≤ 4 THEN
TotalStars ← TotalStars + Rating // Add the rating to the total
NumberOfRatings ← NumberOfRatings + 1 // Increment the valid rating count
BREAK // Exit retry loop on valid input
ELSE
PRINT "Invalid rating. Please enter a value between 0 and 4."
Attempts ← Attempts + 1
END IF
CATCH
PRINT "Invalid input. Please enter a numeric value between 0 and 4."
Attempts ← Attempts + 1
END TRY
END WHILE

IF Attempts = 3 THEN
PRINT "Too many invalid attempts. Moving to the next user…"
END IF

IF Rating 0 THEN
AverageRating ← TotalStars ÷ NumberOfRatings // Calculate the average rating
PRINT “Average star rating for the movie: “, AverageRating
ELSE
PRINT “No ratings were entered.”
END IF
END
“`

This version uses `←` for assignment, `∧` for logical AND, and `÷` for division, aligning with a structured pseudocode format while incorporating C++-style logic. Let me know if you’d like further refinements!