Question
Weather Statistics Please write a program about Weather Statistics. This program uses a structure named WeatherInfo to store the following weather data for a particular
Weather Statistics
Please write a program about Weather Statistics. This program uses a structure named WeatherInfo to store the following weather data for a particular month
totalRainfall (datatype: double)
highTemperature (datatype: double)
lowTemperature (datatype: double)
averageTemperature (datatype: double)
The program uses an array of 12 structures to hold weather data for an entire year. When the program runs, it asks the user to enter data (totalRainfall, highTemperature, lowTemperature) for each month. (The averageTemperature should be calculated) Once the data 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 all the monthly average temperatures.
Note: the temperature should be in the range [-100, 140]
When user input high temperature and low temperature for each month, the high temperature should be higher or equal to low temperature, if not, the program will display ERROR: high temperature should be higher or equal to the low temperature and asks user to input high temperature and low temperature again, if the new high temperature is still lower than the low temperature, the program will display ERROR: high temperature should be higher or equal to the low temperature and asks user to input high temperature and low temperature again, until the current high temperature is higher or equal to the low temperature, the program will continue to execute the next statement.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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