Question: Using C++ C++ program that will have the user enter Celsius temperature readings for each day of the week and then display a report showing

Using C++

C++ program that will have the user enter Celsius temperature readings for each day of the week and then display a report showing both the Celsius and Fahrenheit temperatures for each day entered. This program requires the use of arrays.

Using C++ C++ program that will have the user enter Celsius temperature

Prompting: For this lab, rather than prompt the user Enter temperature for Day 1: , use the actual day in the prompt, e.g. Enter the temperature for Sunday: . You are required to use a loop and GetValidDouble()to produce this prompt and get user input respectively.

Converting an Integer to a Day String: Write a function that will accept an integer as an argument and return a string. If the argument is in the range 1 to 7 inclusively, return the corresponding name for the day. For example, an argument of 1 should return Sunday, an argument of 2 should return Monday, etc. Although you could use an ifelse chain or a switch, the trick to doing this very efficiently is to implement an array of strings that contains the names of the days as elements and to use the argument as an index to find the right day. If the argument is outside of the range 1 to 7, return an error message instead.

Range Validation: The lowest natural surface temperature on Earth is 89.2C. It was measured on 21 July 1983 at Vostok Research Station in the Antarctic.1 The highest surface temperature recorded is 57.8C, in Aziziya, Libya on 13 September 19222. Given these values, the temperatures the user enters should fall between the range 90.0C and +60.0C. Do not accept an input value outside of that range.

readings for each day of the week and then display a report

To generate the required output, you will need to convert each Celsius temperature to Fahrenheit. Given this is a fairly generic task that could be reused in another program, you should create a function to do this. The actual calculation is straight forward; the function body may only need to be one line of code, so the function should be inline. Keep in mind that a processing function should only do processing, not input or output. Pass the Celsius temperature in as a parameter and send the Fahrenheit temperature back using a return statement.

Output:

Write a function template that will display the temperatures entered in Celsius and Fahrenheit formatted as above. You must pass this function at least the array storing the Celsius temperatures and the number of items in that array. You could pass an array containing Fahrenheit temperatures although it is more efficient to simply call your processing function to convert each individual temperature as you need it. Either way is acceptable.

TEMPERATURE REPORTER lease enter the temperature for each day of the week elsius temperature for Sunday 108.8 nualid input. Please try again and enter a ualue between -90 and 60 99.9 Invalid input. Please try again and enter a value between -90 and 60 OT! Invalid input. Please try again and enter a numeric value 5.5 elsius temperature for Monday

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!