Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A. Hollywood Movie Rating Guide, in which users continuously enter a value from

ID: 3562983 • Letter: A

Question

A.
Hollywood Movie Rating Guide, in which users continuously enter a value from 0 to 4 that indicates the number of stars they are awarding to the Guide's featured movie of the week. The program executes continuously until a user enters a negative number to quit. If a user enters a star value that does not fall in the correct range, reprompt the user continuously until a correct value is entered. At the end of the program, display the average rating for the movie.

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.

C.
Modify the movie-rating program so that the user is prompted continuously for a movie title until ZZZZZ is entered. Then, for each movie,continuously accept star-rating values until a negative number is entered. Display the average rating for each movie.

Explanation / Answer

A

You did not specify which programming language, so I will use Java.

import java.util.Scanner;

public class rateMovie{
public static void main(String[] args){

Scanner inScan = new Scanner(System.in);
double sum = 0;
double curr = 0;
double ave;
int count = 0;

while (curr >= 0){
System.out.println("Enter a rating (0-4). Negative number to quit.");
curr = inScan.nextDouble();

if (curr > 4){
System.out.println("Invalid value. Not recorded.");
}
if (curr >= 0 && curr <= 4){
sum = sum + curr;
count++;
}

if (curr < 0){
ave = sum/(double)(count);
System.out.println("The average rating is " + ave);
}
}
}
}   

B

Start
Declaration
num rating=0.0
num total=0.0
num RANGE=5
num count=1
num tries=0
output "Enter ratings of users:"
input rating
while rating>=0 repeat

       while rating<0 AND rating>RANGE AND tries<3
            print" Out of range 0-4 needed"
            input rating
            tries=tries+1         
      end while
      if tries==3
         exit loop         
         total+=rating
         count=count+1
          input rating
  
   end while  
if tries ==3
     print " Error Rating!!!!"
else
print "Average Rating:",total/count

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote