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
Step: 1
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