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
Which of these devices can completely stop broadcasts from being passed on across the network? routerswitchaccess ponthub
cestrela7 [59]

Answer

An Access point can completely stop broadcasts from being passed on across the network.

Explanation.

An Access point is a hardware type that is part of local area network which has capability of allowing wireless communication from devices through a wireless stand,which connects in between devices and the network. A good example of these devices are routers that allows wireless devices to connect to a wireless network.So when it is passed on across a network an Access point can completely stop.

8 0
3 years ago
Read 2 more answers
Help with prg 140 class it is really giving me a hard time understanding it<br>​
Snowcat [4.5K]

Answer:

post your homework so we can help you.

Explanation:

8 0
3 years ago
In what order will the transmission control protocol (tcp) generally send all segments
IgorC [24]

The order that the transmission control protocol (tcp) generally send all segments is a sequential order.

<h3>What is a transmission control protocol?</h3>

It should be noted that the transmission contol protocol simply means a communication standard that enables application programs to exchange messages over a network

In this case, the order that the transmission control protocol (tcp) generally send all segments is a sequential order.

Learn more about transmission contol protocol on:

brainly.com/question/14219758

#SPJ12

4 0
2 years ago
Compose a loop program to examine the eight bytes in the words y and z. If a byte is the code for a decimal number, output it to
Over [174]

Answer:

See explaination

Explanation:

A loop program is a type of program that supports iteration.

It is a conditional statement ptogram that produces its result after a series of iteration or repetition from one loop to the other.

Please go to attachment for the loop program that examines the eight bytes in the words y and z. If a byte is the code for a decimal number, output it to the console. Otherwise, simply ignore it and examine the next byte.

5 0
4 years ago
What is capble of house astrounots for research
tigry1 [53]

Answer:

A space station is a capable of housing astronauts while they are conducting research.

Explanation:

6 0
4 years ago
Read 2 more answers
Other questions:
  • Choose the answer that best explains why Morse's invention of the telegraph changed media forever.
    11·2 answers
  • How many generations of computer languages have there been since the middle of the 20th century?
    9·2 answers
  • A.<br> Post-It note<br> b.<br> notebook<br> c.<br> tutor<br> d.<br> spell check
    14·1 answer
  • Want summmmmmmm bec i do lol
    9·1 answer
  • Explain the differences between apple and android
    14·2 answers
  • Match the following Microsoft Windows 7 ​
    9·1 answer
  • Sarah is having a hard time finding a template for her advertising business that she may be able to use at a later
    12·1 answer
  • ¿Consideran que nuestra sociedad chilena (modelo económico, los medios de comunicación, educación, la publicidad) promueve la sa
    11·1 answer
  • This feature allows you to adjust your view to see the lower and upper part of a document
    15·2 answers
  • Chantal has configured the network at her company's new headquarters with a number of VLANs. All devices joined to the individua
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!