Computers and Technology, 17.04.2020 23:14 chem1014
For this exercise, you will be simulating a weather station responsible for recording hourly
temperatures and reporting on certain characteristics (e. g., average temperature) from your recordings.
You will also be expanding on your experience in creating functions and passing them more complex
parameters (i. e., complete array arguments).
Specifications:
DDI&T a C++ program to input, store, and process hourly temperatures for each hour of the day
(i. e., 24 temperatures). Your program should be divided logically into the following parts:
1. In function main() declare an array:
array HourlyTemperatures;
(where NUM_TEMPERATURES should be declared as a constant with the value, 24), that
will be used to hold one temperature for each hour of the day. Declare other variables and
constants as you feel are necessary.
2. Pass the HourlyTemperatures array to a function,
void GetTemperatures(array & Temperatures);
This function must interactively prompt for and input temperatures for each of the 24 hours
in a day (0 through 23). For each temperature that is input, verify that its value lies in the
range of minus 50 degrees and plus 130 degrees (i. e., validate your input values). If any
value is outside the acceptable range, ask the user to re-enter the value until it is within this
range before going on to the next temperature (HINT: use a nested loop (e. g., do-while) that
exits only when a value in the specified range has been entered). Store each validated
temperature in its corresponding element of the 24-element integer array passed as a
parameter to the function.
3. Next pass the filled array to a function,
double ComputeAverageTemp(array & Temperatures);
This function computes the average temperature of all the temperatures in the array and
returns this average to the calling function.
4. Finally, pass your array and the computed average temperature to another function,
void DisplayTemperatures(array & Temperatures,
double AverageTemp);
which displays the values of your temperature array in a columnar format followed by the
values for the high temperature, low temperature, and average temperature for the day.
NOTE: If you want to create separate function(s) to find and return the high and low
temperature values, then feel free to do so!
The resulting output should look like this:
Hour Temperature
00:00 42
01:00 42
. . . . . . . . // Your program output must include all of these too!
22:00 46
23:00 48
High Temperature: 68
Low Temperature: 42
Average Temperature: 57.4
5. Since you have created functions to perform each of the functional steps of your solution,
your main() function should be quite simple. The pseudo code for main() might look
something like this:
int main()
{
// declare local constant(s), variable(s), and array(s).
do
{
// call GetTemperatures(HourlyTemperatures) ;
// call ComputeAverageTemp(HourlyTemperatur es);
// call DisplayTemperatures(HourlyTemperatu res, AverageTemperature);
} while // user wants to process more days of temperatures
return 0;
}
6. Test your program with at least two (2) different sets of temperatures. Make sure you
enter values to adequately test your temperature-validation code (e. g., temperatures below –
50 and above +130 degrees).
Deliverable(s):
Turn in the properly documented source listing of your program and complete outputs from
at least TWO (2) test "runs". Additionally, turn in screen captures of some of your interactive inputs
demonstrating that your program properly detects invalid inputs and prompts the user to re-enter the
temperature(s). Starting with this exercise you must document your solution in accordance with the
examples shown at the back of this syllabus and provided on the Portal.
Answers: 1
Computers and Technology, 22.06.2019 10:00
Businesses allocate resources for their best and most productive uses. the more a resource, the more costly it will be. a manufacturer that requires scarce and costly resources is likely to charge for its products.
Answers: 2
Computers and Technology, 23.06.2019 05:30
Sally is editing her science report about living things. she needs to copy a paragraph from her original report. order the steps sally needs to do to copy the text to her new document.
Answers: 1
Computers and Technology, 23.06.2019 23:30
Worth 50 points answer them bc i am not sure if i am wrong
Answers: 1
Computers and Technology, 24.06.2019 01:00
Me if you do then you get 10 points and brainliest
Answers: 1
For this exercise, you will be simulating a weather station responsible for recording hourly
Chemistry, 15.04.2020 01:32
Social Studies, 15.04.2020 01:32
Mathematics, 15.04.2020 01:32
English, 15.04.2020 01:33
Advanced Placement (AP), 15.04.2020 01:33