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:

  1. The program should make use of 4 variable of the structure. Each variable represents one of the years (2017, 2018, etc.)
  2. The user should be asked to enter the four quarter's rain amount for each year.
  3. Each year's total and average rain amount should be calculated and stored in the appropriate member of each structure variable.
  4. 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 #include using namespace std; // Declaration of WeatherStatistics struct WeatherStatistics { const int NUM_YEAR = (2017, 2018, 2019, 2020); double First_Quarter_Rain_Amount; double Second_Quarter_Rain_Amount; double Third_Quarter_Rain_Amount; double Fourth_Quarter_Rain_Amount; double Total_Annual_Rain_Amount; double Average_Quarterly_Rain_Amount; }; // Function Prototypes void getYearData(WeatherStatistics&);

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!