// Nicolas Ruano CS1A Chapter 3 Pp.143-144 #4
/*******************************************************************************
* CALCULATING THE AVERAGE RAINFALL
* ____________________________________________________________________________
* In this program, we check on the following months and their average of
* rainfall in each of the following different months provided below
* ___________________________________________________________________________
* INPUT
* month1: June
* month2: July
* month3: Augest
*
* rain1: June 5.2
* rain2: July 6.8
* rain3: Augest 8.2
* ____________________________________________________________________________
* PROCESS
* we get the results by solving out:
*
* Average = (rain1 + rain2 + rain3) / 3.0
* ____________________________________________________________________________
* OUTPUT
* The data being provided, based on the mathematical proceudre.
*******************************************************************************/
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main() {
string month1, month2, month3;
double rain1, rain2, rain3, average;
// Ask user for inputs
cout << "Enter the name of the first month: June";
cin >> month1;
cout << "Enter the rainfall (in inches) for June: 5.2" << month1 << ": ";
cin >> rain1;
cout << "Enter the name of the second month: July";
cin >> month2;
cout << "Enter the rainfall (in inches) for July 6.8" << month2 << ": ";
cin >> rain2;
cout << "Enter the name of the third month: Augest";
cin >> month3;
cout << "Enter the rainfall (in inches) for Augest: 8.2" << month3 << ": ";
cin >> rain3;
// Calculate average rainfall
average = (rain1 + rain2 + rain3) / 3.0;
// Display result
cout << fixed << setprecision(2);
cout << "\nThe average rainfall for June "
<< month1 << ", July" << month2 << ", and Augest" << month3
<< " is " << average << "6.73 inches." << endl;
return 0;
}