Question: RAINFALL CLASS Write a RainfallDriver class that has the following methods: main which creates an array of rainfall values for a year. Use the following

RAINFALL CLASS

Write a RainfallDriver class that has the following methods:

main which creates an array of rainfall values for a year. Use the following to do so:

double[] rain = {.5,.3,.7,1.2,.1,.8,2.1,.5,3.3,2.8,.9,1.2};

a method that calculates and prints the total rainfall for the year named total()

a method that calculates and prints the average monthly rainfall named average()

a method that determines and print the maximum rain in any one month named max()

a method that determines and prints the minimum rain in any one month named min()

Each of the last four methods will need to define the array as a parameter that is passed in on the method call. So the methods will have a single parameter which is a double[].

After you create the array in main, call each of the four methods so that they can print their information. Check out Ex9PrimitiveArrayWithMethods for an example on how to start.

RAINFALL CLASS Write a RainfallDriver class that has the following methods: main

Sample output:

The total rainfall for the year is: 14.4

The average monthly rainfall is: 1.2

The maximum monthly rainfall is: 3.3

The minimum monthly rainfall is: 0.1

> CRainfallDriver itp120mod5ANSWERS171 RainfallDriver) o main Stringf) void total doublel void o averageldoublel1)kvoid Omaxdoublel) void min(doublelvoid

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!