Question
This program is about weather statistics. Write a program that uses a structure to store the following data for the purpose of a research in
This program is about weather statistics.
Write a program that uses a structure to store the following data for the purpose of a research in meteorology:
- Year (2017, 2018, 2019, 2020)
- First-Quarter Rain Amount
- Second-Quarter Rain Amount
- Third-Quarter Rain Amount
- Fourth-Quarter Rain Amount
- Total Annual Rain Amount
- Average Quarterly Rain Amount
Requirements:
- The program should make use of 4 variable of the structure. Each variable represents one of the years (2017, 2018, etc.)
- The user should be asked to enter the four quarter's rain amount for each year.
- Each year's total and average rain amount should be calculated and stored in the appropriate member of each structure variable.
- The results should then be displayed on the screen.
Input validation: Negative numbers for the rain amount should not be accepted
this is what i have so far and not sure what i am missing to seperate line for each answer entered and to add annual and quarterly questions :
//Weather statistics #include
double First_Quarter_Rain_Amount(WeatherStatistics[], int); double Second_Quarter_Rain_Amount(WeatherStatistics[], int); double Third_Quarter_Rain_Amount(WeatherStatistics[], int); double Fourth_Quarter_Rain_Amount(WeatherStatistics[], int); double Total_Annual_Rain_Amount(WeatherStatistics[], int, int &); double Average_Quarterly_Rain_Amount(WeatherStatistics[], int, int&);
int main() { //constant for year const int NUM_YEAR = (2017, 2018, 2019, 2020);
string Year_2017, Year_2018, Year_2019, Year_2020;
float First_Quarter_Rain_Amount_Year, Second_Quarter_Rain_Amount_Year, Third_Quarter_Rain_Amount_Year, Fourth_Quarter_Rain_Amount_Year, Total_Annual_Rain_Amount_Year, Average_Quarterly_Rain_Amount_year, total, average;
//ask user to enter rain amounts cout << endl; cout << " This program calculates the average"; cout << " rainfall for each quarter and year." << endl; cout << " Press Enter to continue." << endl; cin.get();
// information cout << "Enter the year for Weather statistics : "; cin >> Year_2017, Year_2018, Year_2019, Year_2020; cout << "Enter first quarter rain amount "; cout<< ":"; cout << "Enter second quarter rain amount"; cout << ": "; cout << " Enter third quarter rain amount"; cout << ": "; cout << "Enter fourth quarter rain amount"; cout << ": "; cin >> Total_Annual_Rain_Amount_Year;
//calculate total and average total= Total_Annual_Rain_Amount_Year; average = Total_Annual_Rain_Amount_Year, First_Quarter_Rain_Amount_Year, Second_Quarter_Rain_Amount_Year, Third_Quarter_Rain_Amount_Year, Fourth_Quarter_Rain_Amount_Year; cout<< endl; return 0;
}
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