// NUR HIDAYU BINTI MOHAMED & PREMA KARIRA ANAS SULAIMAN SECTION 12 GROUP 5
// ASSIGNMENT 1 ON 6th of November 2018

#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

int main ()
{
const int months = 12;
int count = 0;
string name[months]= {"January","February","March","April","May","June","July","August","September","October","November","December"};
double rain[months], average, totalmonths=0, year;

cout << "Please enter the number of years : ";
cin >> year;

do{
for(count = 0; count < months; count++) 
{
cout <<"\nHow many inches of rain does "<< name[count];
cout<< " have? \n";
cin >> rain[count];
while (rain[count] < 0)
{
cout << "\nPlease enter a number greater than 0."<< endl;
cin >> rain[count];
}
}
for(int count=0; count < months; count++) 
totalmonths += rain[count];

average = totalmonths / months;

for( int count = 0; count < months; count++) 
{
cout << name[count];
cout<< " has ";
cout<< rain[count] << " inches of rainfall.\n";
}
		cout << setprecision(4) << fixed << showpoint;

		cout <<"\nTotal Rainfall throughout the year is " << totalmonths << " inches" << endl;

		cout <<"The average monthly rainfall is " << average << " inches"<< endl;	
	cout << "\nPlease enter the number of years : ";
	cin >> year;}
	while (year != 1 );

return 0;
}

