In this lab, you write a while loop that uses a sentinel value to control a loop in a C++ program that has been provided. You also write the statements that make up the body of the loop.
The source code file already contains the necessary variable declarations and output statements. Each theater patron enters a value from 0 to 4 indicating the number of stars the patron awards to the Guide’s featured movie of the week. The program executes continuously until the theater manager enters a negative number to quit. At the end of the program, you should display the average star rating for the movie.
Instructions
-
Ensure the source code file named MovieGuide.cpp is open in your code editor.
-
Write the while loop using a sentinel value to control the loop, and write the statements that make up the body of the loop. The output statements within the loop have already been written for you.
- Ensure you include the calculations to compute the average rating.
- Execute the program by clicking the Run button.
-
Input the following: 0, 3, 4, 4, 1, 1, 2, -1
-
Ensure the average output is correct.
Strictly use the given code
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 3 images
- True or False: C++ uses negative values to represent "False" and positive values to represent "True". It is possible that the body of a while loop may not execute at all.arrow_forwardIn C programming: A while loop will always be executed at least once, even if expression is initially zero. True False The while and for loops are known as the "test-at-the-top" loops. * True Falsearrow_forwardComputer Science Part C: Interactive Driver Program Write an interactive driver program that creates a Course object (you can decide the name and roster/waitlist sizes). Then, use a loop to interactively allow the user to add students, drop students, or view the course. Display the result (success/failure) of each add/drop.arrow_forward
- In Java, If a semicolon is placed at the end of a for statement, the action of the for loop is empty. True or Falsearrow_forwardprogram must include a processing loop that allows multiple sets of data to be processed and the program should be terminated when there is no more data to process Develop a program in python that allows the user to enter a start value of 1 to 4, a stop value of 5 to 12 and a multiplier of 2 to 8. The program must display a multiplication table with results using these values. For example, if the user enters a start value of 3, a stop value of 7 and a multiplier value of 3, the table should be displayed as follows: Multiplication Table 3 x 3 = 9 3 x 4 = 12 3 x 5 = 15 3 x 6 = 18 3 x 7 = 21 Run the program with the following values: Start Stop Multiplier 2 10 4 4 12 6arrow_forwardDrawa structured flowchart , C++, write pseudocode that describes the process of guessing a number between 1 and 100. After each guess, the player is told that the guess is too high or too low. The process continues until the player guesses the correct number. Pick a number and have a fellow student try to guess it following your instructions.arrow_forward
- C++arrow_forwardprogram4_2.pyWrite a program that uses a while loop to enable the user to enter any number of positive integers. The loop should end when a sentinel value of 0 (zero) is entered. The program should then report the sum of the even integers and the sum of the odd integers.arrow_forwardDistance Traveled, v 1.0 Purpose. The purpose of this lab is to perform a calculation repetitively within a loop. The loop may be either a while loop or a for loop. You are to write a program that calculates the distance a vehicle has traveled in a certain number of hours. Write a program called vehicle Trip.cpp to calculate the distance traveled for a given speed. Requirements. 1. Using the following formula: distance rate * time = calculate how many miles a vehicle has travelled in a certain number of hours. 2. Have the program ask the use for the speed of the vehicle (in miles per hour) and how many hours the vehicle has traveled. Do not accept a negative number for the speed of the vehicle, and do not accept a value less than 1 for hours the vehicle has traveled. 3. The program should use a loop to display the distance the vehicle has travelled for each hour of the time period that has been inputted. Program I/O. Input: Speed of the vehicle (in miles per hour), and Number of hours…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education