Question
Write a RainFall class that stores the total rainfall for each of 12 months into an array of doubles. You can assign the values during
Write a RainFall class that stores the total rainfall for each of 12 months into an array of doubles. You can assign the values during declaration. The program should have methods that return the following:
The total rainfall for the year (sum the array)
The month having the most rain (search the array for the highest number and save the index and the value - The value is the amount of rainfall. Use an if statement to determine month. if the index is 0 it is January, if index is 1 it is February, etc...)
Your output should be as follows (with XX representing the numbers based on your array):
Total Rainfall for the Year: XX The month of MM has XX rainfall
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started