Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*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

image text in transcribed
image text in transcribed
*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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Privacy In Statistical Databases International Conference Psd 2022 Paris France September 21 23 2022 Proceedings Lncs 13463

Authors: Josep Domingo-Ferrer ,Maryline Laurent

1st Edition

3031139445, 978-3031139444

More Books

Students also viewed these Databases questions

Question

What is gravity?

Answered: 1 week ago

Question

What is the Big Bang Theory?

Answered: 1 week ago