Question: IN C + + PLEASE Solving the Weather Statistics Problem This assignment will solve a problem using weather statistics Part I - Understand Weather Statistics
IN C PLEASE
Solving the Weather Statistics Problem
This assignment will solve a problem using weather statistics
Part I Understand Weather Statistics Problem pts
The Question # in Gaddis book chapter illustrate a solution for how to solve the weather statistics
problem. You can read it in chapter I am copy the original code here for your reference.
Weather Statistics
Write a program that uses a structure to store the following weather data
for a particular month:
Total Rainfall
High Temperature
Low Temperature
Average Temperature
The program should have an array of structures to hold weather data
for an entire year. When the program runs, it should ask the user to enter
data for each month. The average temperature 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.
Input Validation: Only accept temperatures within the range between and
degrees Fahrenheit.
Get this program done and save your file as weatherStatisticFNameLName.cpp There is a video
note in the book to help you to get this done. Copy and paste a set of output at the end of
program will well descripted labels. This label should clearly indicate that this is the original
problem solution.
Part II Modify the Weather Statistics Program I pts
Do the programming challenge question # and copypast a set of sample output at the end of program.
In this set of out put you will clearly indicate that this run is from Part II and the line numbers of the
source code that include your modifications as comments No partial credit given to this part. You will
either get points for follow the instructions strictly or get points. The instruction is given in the text
book. I put a copy here for your reference.
Weather Statistics Modification
Modify the program that you wrote for Programming Challenge
weather statistics so it defines an enumerated data type with
enumerators for the months JANUARY FEBRUARY, so on The
program should use the enumerated type to step through the elements of
the array.
Part III Modify the Weather Statistics Program II points
Modify the Weather Statistics program so it will do the following:
Prompt user only for the Total Rainfall for each month.
Generate random number for the "High Temperature" and "Low Temperature" in each month.
But the Tricky is that the random number must be reasonable. Look at the following table for
some unreasonable data generated from the rand function:
here is the program #include
#include
#include
using namespace std;
Constant for the number of months
const int NUMMONTHS ;
Declaration of the WeatherInfo structure
struct WeatherInfo
double rain; Total rainfall
double high; High temperature
double low; Low temperature
double averageTemp; Average temperature
;
int main
Create an array of WeatherInfo structures
WeatherInfo yearNUMMONTHS;
int index ;
Get the weather data for each month.
cout "Enter the following information:
;
for index ; index NUMMONTHS; index
Get the rainfall.
cout "Month index endl;
cout tTotal Rainfall: ;
cin yearindexrain;
Get the high temperature.
cout tHigh Temperature: ;
cin yearindexhigh;
Validate the high temperature.
while yearindexhigh yearindexhigh
cout "ERROR: Temperature must be in the range
of through
;
cout tHigh Temperature: ;
cin yearindexhigh;
Get the low temperature.
cout tLow Temperature: ;
cin yearindexlow;
Validate the high temperature.
while yearindexlow yearindexlow
cout "ERROR: Temperature must be in the range
of through
;
cout tLow Temperature: ;
cin yearindexlow;
Calculate the average temperature.
yearindexaverageTemp
yearindexhigh yearindexlow;
Calculate total annual rainfall
double totalRain ;
for index ; index NUMMONTHS; index
totalRain yearindexrain;
Calculate average monthly rainfall
double aveMonthRain totalRain NUMMONTHS;
Calculate the average monthly average temperature
double aveTotal aveAve;
for index ; index NUMMONTHS; index
aveTotal yearindexaverageTemp;
aveAve aveTotal NUMMONTHS;
Find the highest & lowest temperatures
double highest, lowest, highMonth lowMonth ;
highest yearhigh;
lowest yearlow;
for index ; index NUMMONTHS; into part :
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
