This program will input and store meteorological data into an array. The program will prompt the user to enter the average monthly rainfall for a specific region and then use a loop to cycle through the array and print out each value. The program should store up 5 years of meteorological data. Data is collected once per month. The program should provide the option to the user of not entering any data.
I will use sequential, selection, and repetition programming statements and an array to store data.I will define a 2-D array of Float number: Raindata to store the Float values input by the user. To store up to 5 years of monthly data, the array size should be at least 5*12 = 60 elements. In a 2D array this will be RainData. We can use #defines to set the number of years and months to eliminate hardcoding values.
A float number (rain) will also be needed to input the individual rain data.A nested for loop can be used to iterate through the array to enter Raindata. A nested for loop can also be used to print the data in the array.A array of strings can be used to store year and month names. This will allow a tabular display with labels for the printout.Functions will be used to separate functionality into smaller work units. Functions for displaying the data and inputting the data will be used.A selection statement will be used to determine if data should be entered.