1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Inga [223]
3 years ago
10

Design a program for the Hollywood Movie Rating Guide, which can be installed in a kiosk in theaters. Each theater patron enters

a value from 0 to 4 indicating the number of stars that the patron awards to the Rating Guide's featured movie of the week. If a user enters a star value that does not fall in the correct range, prompt the user continuously until a correct value is entered. The program executes continuously until the theater manager enters a negative number to quit. At the end of the program, display the average star rating for the movie.
Computers and Technology
1 answer:
ehidna [41]3 years ago
6 0

Answer:

The program in cpp is given below.

#include <iostream>

using namespace std;

int main()

{

   //variables declared to hold sum, count and average of movie ratings

   int sum=0;

   int count=0;

   int rating;

   double avg;

   //audience is prompted to enter ratings

   do{

       std::cout << "Enter the rating (0 to 4): ";

       cin>>rating;

       if(rating>4)

           std::cout << "Invalid rating. Please enter correct rating again." << std::endl;

       if(rating>=0 && rating<=4)

       {

           sum=sum+rating;

           count++;

       }

       if(rating<0)

           break;

   }while(rating>=0);

   //average rating is computed

   avg=sum/count;

   std::cout << "The average rating for the movie is " << avg << std::endl;  

   return 0;

}

OUTPUT

Enter the rating (0 to 4): 1

Enter the rating (0 to 4): 2

Enter the rating (0 to 4): 0

Enter the rating (0 to 4): 5

Invalid rating. Please enter correct rating again.

Enter the rating (0 to 4): 1

Enter the rating (0 to 4): -1

The average rating for the movie is 1

Explanation:

1. Variables are declared to hold the rating, count of rating, sum of all ratings and average of all the user entered ratings.

2. The variables for sum and count are initialized to 0.

3. Inside do-while loop, user is prompted to enter the rating for the movie.

4. In case the user enters a rating which is out of range, the user is prompted again to enter a rating anywhere from 0 to 4.

5. The loop executes until a negative number is entered.

6. Inside the loop, the running total sum of all the valid ratings is computed and the count variable is incremented by 1 for each valid rating.

7. Outside the loop, the average is computed by dividing the total rating by count of ratings.

8. The average rating is then displayed to the console.

9. The program is written in cpp due to simplicity since all the code is written inside main().

You might be interested in
You find that you are missing a very important file. After much searching, you have determined that it is no longer on your comp
Pani-rosa [81]

You can use backup utility programs and file management programs.

5 0
3 years ago
Read 2 more answers
You can add envelopes to existing documents. <br> a. True <br> b. False
Lemur [1.5K]
<span>The answer is true. Once documents are created, they may be accessed again and have envelopes pointing to them even when the documents are empty.</span>
3 0
2 years ago
Given the following code, what is output by the method call, mystery(6 * 8)?
Elena-2011 [213]

Answer:

i honestly don't know

Explanation:

im not smart

3 0
3 years ago
What kind of value should an employee possess when employees are expected to be responsible and fair?
WINSTONCH [101]

I'd say professionalism

Professionalism in a workplace setup is acting in a responsible and fair manner in all your personal and work activities. It is always seen as sign of maturity and self-confidence. This work value includes learning every aspect of a job and performing it to the best of your God given ability.

3 0
2 years ago
Help brainleist giving exam
Digiron [165]

Explanation:

11. True

12: Electronic Fund Transfer

13. True

14. I'm not sure but I think yes?..

(I'm not sure if your including number 15 but just in case, the full form of PIN is personal identification number)

4 0
2 years ago
Other questions:
  • Java - Given a String variable response that has already been declared, write some code that repeatedly reads a value from stand
    12·1 answer
  • Okay so, not really a question but whatever it’s been bothering me.
    9·2 answers
  • A type of Knowledge Management System is called
    5·1 answer
  • Microsoft’s SharePoint server product dramatically altered the content and records management (RM) markets. Crocker (2015), edit
    6·1 answer
  • Study the sentences below. A.Changing the properties of characters in a sentence or paragraph in a Word document helps increase
    5·2 answers
  • The rules of right-of-way<br> Pedestrians, bicyclists, and skateboarders<br> when they use the road.
    12·1 answer
  • Why was the IPv6 address format created? Select one:
    12·1 answer
  • Declare an ArrayList of Strings. Add eight names to the collection. Output the Strings onto the console using the enhanced for l
    9·1 answer
  • What are some best practices for file management
    8·1 answer
  • 6.What does transgenic mean?​
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!