Computer Science, asked by reddy2550, 8 months ago

write a program to create an array of months of a year and display all the months using for loop​

Answers

Answered by ramshankar8693
0

Answer:

Write a program that stores the name of each month in an array of Strings, and the rainfall for each month of the year into an array of doubles. The program should determine the total rainfall for the year, the average monthly rainfall, and the months with the most and least amount of rain. You will need: Two one-dimensional arrays - one to store the names of each month and another to store the rainfall for each month. (What would be the size of these arrays?)

Use an initialization list to store the names of each month into the String array. A for loop to receive the values of rainfall. You should refer to your string array to get the names for the appropriate month. The rainfall values should be stored in the doubles array. Make sure the user does not enter a negative value for rainfall. (Use a while loop for this part)

A for loop to compute the running sum A variable to store the average A for loop (with a nested if statement) to determine the largest amount of rainfall in the doubles array You need to refer to the String array to indicate the month with the largest rainfall.

A for loop (with a nested if statement) to determine the smallest amount of rainfall You need to refer to the String array to indicate the month with the largest rainfall.

Similar questions