//Kanoa Holden CS1A Chapter 3, P. 143 Q#4
//
/*******************************************************************************
*
* COMPUTE AVERAGE RAINFALL IN INCHES
* _____________________________________________________________________________
* This program calculates the average amount of rainfall in certain months in
* inches.
*
* Computation is based on the formula:
* averageRainfall = (rain1 + rain2 + rain3) / 3.0
* _____________________________________________________________________________
* INPUT
* month1 : name of first month
* rain1 : amount of rain in first month
* month2 : name of second month
* rain2 : amount of rain in second month
* month3 : name of third month
* rain3 : amount of rain in third month
*
* OUTPUT
* averageRainfall : average rainfall in the three months
*
******************************************************************************/
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main() {
// Variables to store the names of the months
string month1, month2, month3;
// Variables to store the amount of rainfall for each month
double rain1, rain2, rain3;
// Ask the user to input the name and rainfall for each month
cout << "\nEnter the name of the first month: ";
cin >> month1;
cout << "\nEnter the amount of rain (in inches) for " << month1 << ": ";
cin >> rain1;
cout << "\nEnter the name of the second month: ";
cin >> month2;
cout << "\nEnter the amount of rain (in inches) for " << month2 << ": ";
cin >> rain2;
cout << "\nEnter the name of the third month: ";
cin >> month3;
cout << "\nEnter the amount of rain (in inches) for " << month3 << ": ";
cin >> rain3;
// Calculate the average rainfall
double averageRainfall = (rain1 + rain2 + rain3) / 3.0;
// Display the average rainfall
cout << fixed << setprecision(2);
cout << "\nThe average rainfall for " << month1 << ", " << month2 << ", and " << month3 << " is " << averageRainfall << " inches." << endl;
return 0;
}