Question: Write an application that solves Programming Exercise 5-4 from the text. The application continuously prompts the user for a series of daily high temperatures (as
Write an application that solves Programming Exercise 5-4 from the text. The application continuously prompts the user for a series of daily high temperatures (as integers) until the user enters a sentinel value of 999. Valid temperatures range from -20 through 130 Fahrenheit (inclusive). When the user enters a valid temperature, add it to a total; when the user enters an invalid temperature, display the error message:
C:WINDOWSlsystem32\cmd.exe Enter temperatures from -20 to 130 (999 to stop) Enter temperature: abcd Valid temperatures range from -20 to 130. Please reenter temperature Enter temperature: -21 Valid temperatures range from -20 to 130. Please reenter temperature Enter temperature: 131 Valid temperatures range from -20 to 130. Please reenter temperature Enter temperature: 10e Enter temperature: 9e Enter temperature: 95 Enter temperature: 97 Enter temperature: 999 You entered 4 valid temperatures. The mean temperature is 95.5 degrees. Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
