Question: Java Rainfall Class. Write a Rainfall class that stores the total amounts of rainfall for each of the 12 months of a year into an

Java

Rainfall Class. Write a Rainfall class that stores the total amounts of rainfall for each of the 12 months of a year into an array of doubles. You should have a setter that accepts the array from the main program and copies that into a private array. The program should include methods that return the following:

prints the values in the array in a JOptionPane or scrollable textbox

the total rainfall for the year

the average rainfall for the year

the month with the most rain

the month with the least rain

Write a second program that instantiates the Rainfall class and tests it by prompting the user for the rainfall data, using a setter to pass that array, and then displays the results of each of the above methods in a JOptionPane.

Input Validation: Do not accept negative values for monthly rainfall.

Draw a UML diagram (rather than a flowchart) for this class.

Project Rubric

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!