Question
Write a program named TemperaturesComparison that allows a user to input five daily Fahrenheit temperatures that must range from ?30 to 130; if a temperature
Write a program named TemperaturesComparison that allows a user to input five daily Fahrenheit temperatures that must range from ?30 to 130; if a temperature is out of range, require the user to reenter it. If no temperature is lower than any previous one, display a message Getting warmer. If every temperature is lower than the previous one, display a message Getting cooler. If the temperatures are not entered in either ascending or descending order, display a message It?s a mixed bag. Finally, display the temperatures in the order they were entered, and then display the average of the temperatures.
The results should look like this:
C: C:\WINDOWS\system32\cmd.exe Enter temperature 1 >> 70 Enter temperature 2 >> 68 Enter temperature 3 >> 66 Enter temperature 4 >> -40 Out of range -- please reenter. Enter temperature 4 >> 64 Enter temperature 5 >> 62 Getting cooler: 70 68 Press any key to continue. 66 . 64 62 C: C:\WINDOWS\system32\cmd.exe Enter temperature 1 >> 88 Enter temperature 2 >> 90 Enter temperature 3 >> 92 Enter temperature 4 >> 200 Out of range please reenter. -- Enter temperature 5 >> 96 Getting warmer: 88 90 Press any key to continue. Enter temperature 4 >> 94 92 94 96 0:4. C:\WINDOWS\system32\cmd.exe Enter temperature 1 >> 88 Enter temperature 2 >> 78 3 >> 79 4 >> 84 Enter temperature Enter temperature Enter temperature 5 >>76 It's a mixed bag: 88 Press any key to continue 78 79 84 76
Step by Step Solution
3.50 Rating (153 Votes )
There are 3 Steps involved in it
Step: 1
Program Write a program named TemperaturesComparison that allows a user to input five da...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started