//Cenyao Huang CS1A Homework 3, P. 143, #4
/*********************************************************************************
* COMPUTE AVERAGE RAINFALL
* This program computes the average rainfall for three months.
*
* This program will use the formula:
* average = (rainfall_month1 + rainfall_month2 + rainfall_month3)/3
*
* Input
* month1 : the name of a month
* month2 : the name of another month
* month3 : the name of a different month
* rainfall_month1 : the amount of rainfall for month1
* rainfall_month2 : the amount of rainfall for month2
* rainfall_month3 : the amount of rainfall for month3
*
* Output
* average : the average of rainfall_month1, rainfall_month2, and rainfall_month3
*
*********************************************************************************/
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main() {
string month1, month2, month3; // assign data type to variables
double rainfall_month1, rainfall_month2, rainfall_month3, average;
cout << "Please provide the names of three months: "; // get the names of the months
cin >> month1 >> month2 >> month3;
cout << month1 << " " << month2 << " " << month3 << endl;
cout << "Please provide the rainfall of each month respectively: "; // get the amount of rainfall of each month
cin >> rainfall_month1 >> rainfall_month2 >> rainfall_month3;
cout << rainfall_month1 << " " << rainfall_month2 << " " << rainfall_month3 << endl;
average = (rainfall_month1 + rainfall_month2 + rainfall_month3)/3; // compute and display average
cout << "The average of rainfall for " << month1 << ", " << month2 << ", and " << month3 << " is "
<< fixed << setprecision(2) << average << " inches";
return 0;
}