Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question about : Please help me with this question! Write a program that uses a

ID: 3658357 • Letter: Q

Question

Question about :

Please help me with this question!

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 12 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 the lowest temperatures for the year (and the months they occurred in), and the average of all the monthly average temperatures.

Input Validation: Only accept the temperature within the range between -100 and +140 degrees Fahrenheit.



Here what i had written.


#include <iostream>

#include <iomanip>

using namespace std;

struct Weather

{

double rainfall;

double hightemp;

double lowtemp;

double avgtemp;

};

int main()

{

const int SIZE = 13;

Weather months[SIZE];

int i;

double totalRainfall = 0.0,averageRainfall;

for (int i = 1; i < SIZE; i++)

{

cout << "Enter the rainfall in inches of the month # " << i << " : ";

cin >> months[i].rainfall;

totalRainfall += months[i].rainfall;

averageRainfall = totalRainfall/12;

}

cout << " The Total Rainfall of this year is " << totalRainfall << " inches." << endl;

cout << "The Average Rainfall of this year is " << averageRainfall << " inches." << endl;

cin.get();

return 0;

}





I wrote the months structures but not the entire.

I am missing calculate and display the average monthly rainfall, the total rainfall for the year, the highest and the lowest temperatures for the year and the average of all the monthly average temperatures.




Explanation / Answer

typedef struct{ int total_rainfall; int high_tempareture; int low_tempareture; int average _tempareture; }month_weather; int main(){ month_weather a[12]; int i = 0; for(i = 0;i < 12;i++){ cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote