Question: *code in java* Write a class named Rain Fall which will store rainfall measurement for up to 12 months. Your program should, 1. Ask the

*code in java*  *code in java* Write a class named Rain Fall which will
store rainfall measurement for up to 12 months. Your program should, 1.

Write a class named Rain Fall which will store rainfall measurement for up to 12 months. Your program should, 1. Ask the user for the number of months (a positive number, between 1 and 12). 2. Create an array of the expected input size. 3. Fill the array with randomly generated values. Note: You will need to check whether the randomly generated number is greater than 0. Make sure your array holds only positive numbers. If would like to generate a random number between 1 and 10, then you are supposed to write the code- Random num= new Random(); year = num.nextInt(10) + 1; where, year variable holds the random number generated in between 1 and 10 Similarly, you should modify the above codes to generate a random number in between 1 and 12 4. Create the following methods, described below to calculate and print out the maximum, minimum, sum, average, and difference between max and min of the numbers. Task-1 Determine which month which has the maximum rainfall Print that month's number (1-12) which has maximum rainfall and as well the rainfall amount Task-2 Determine which month which has minimum rainfall Print that month's number (1-12) which has minimum rainfall and as well the rainfall amount Task-3 Determine the total rainfall for each month (sum of all numbers in the array) Print out the total rainfall amount Task-4 Determine the average rainfall for the given months Print out average rainfall amount Task-5 Write JUnit tests to test two of the methods above. Each test should test a single test case

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!