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

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

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions

Question

How did you feel about taking piano lessons as a child? (general)

Answered: 1 week ago