Explore BrainMass
Share

C++ Structure to Store the Weather Data

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

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.........

© BrainMass Inc. brainmass.com October 17, 2018, 12:36 pm ad1c9bdddf
https://brainmass.com/computer-science/cpp/c-structure-to-store-the-weather-data-583946

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
Similar Posting

A C++ console program that will read input data from a text file and performs simple meteoroligical calculations - finding greatest temperature deviation and wind average. Makes use of structures and arrays.

You are developing a database of measured meteoroligical data for use in weather and climate research. Define a structure type measured_data_t with components: site_id( a 4 digit integer), wind_speed, day_of_month, and temperature. Write a program that inputs measured_data_t records and determines the site with the greatest variation in temperature(define here as the biggest difference between extrema) and the site with the highest average wind speed for all the days on file.

View Full Posting Details