/*******************************************************************************
 * Aiden Stannard // CS1A // Chapter 7 Homework: Challange 1# // 10/30/2026
 * 
 * Rainfall Stats
 * 
 * This program recieves 
 ******************************************************************************/
#include <iostream>
using namespace std;

int main()
{
    const int size = 12; // Value for the size of the array
    double year[size]; // array definition
    string months[size] = {"January","February", "March", "April", "May"
    "June","July","Augest","September","October","November","December"};
    double large; 
    double small; 
    string largeMonth;
    string smallMonth;
    double totalRain;
    
    cout << "Enter the total rainfall for the first month of the year: " << endl;
    cin >> year[0];
 
    totalRain = year[0];
    large = year[0];
    small =  year[0];
    largeMonth = months[0];
    smallMonth = months[0];
    
    for (int count = 1; count < size; count++)
    {
        cout << "Enter the total rainfall for " << months[count] << endl;
        cin >> year[count];
        
        while (year[count] < 0) // denies input if negative until a valid number is entered
        {
            cout << "You cannot enter a negative number. Re-enter number: " << endl;
            cin >> year[count];
        }
        
        totalRain += year[count];
        
        if (year[count] > large)
        	large = year[count];
            largeMonth = months[count];
        if (year[count] < small)
        	large = year[count];
            smallMonth = months[count];
    }
    
    cout << "The rainiest month of the year is " << largeMonth << endl;
    cout << "The smallest number in the array is " << smallMonth << endl;
    cout << "The total rainfall for the whole year is " << totalRain 
    << " Inches" << endl;
    cout << "The Average rainfall monthly rainfall is " << totalRain / size << endl;
    return 0;
}

