Share
Explore BrainMass

C++ Structure to Store the Weather Data

Please I need the source.cpp code

Write a program that uses a structure to store the following weather date for a particular month:
Total Rainfall
High Temperature
Low Temperature
Average Temperature

The program should have an array of 12 structures to hold weather date for an entire year. When the program runs, it should ask the user to enter date for each month. (The average temperature should be calculated.) Once the date are entered for all the months, the program should calculate and display the average monthly rainfall, the total rainfall for the year, the highest and lowest temperatures for the year (and the months they occurred in), and the average of the monthly average temperatures.
Input validation: only accept temperatures within the range between -100 and +140 degrees Fahrenheit.

Below is how the code should look like.

Enter the following information:
Month 1
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 2
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 3
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 4
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 5
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 6
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 7
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 8
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 9
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 10
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 11
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Month 12
Total Rainfall:
High Temperature:
Low Temperature:
Average Temperature:
Total Rainfall is:
Average Monthly Rain:
Average Monthly Average Temperature:
Highest Temperature:
Lowest Temperature:
Press any key to continue.........

Solution Preview

Dear Student,
I have included the code. I have used validation only ...

Solution Summary

This solution is in C++. Show a source program that uses a structure to store the weather data. It shows loops For & Do...While and Selection If statements.

$2.19