Rainfall JAVA code question is on the file, please make it work on repl or Jdoodle. it is due by 23:55 12.17 1 CSP26A Java Programming Take Ho

Rainfall JAVA code
question is on the file, please make it work on repl or Jdoodle.
it is due by 23:55 12.17

1

Don't use plagiarized sources. Get Your Custom Assignment on
Rainfall JAVA code question is on the file, please make it work on repl or Jdoodle. it is due by 23:55 12.17 1 CSP26A Java Programming Take Ho
From as Little as $13/Page

CSP26A Java Programming

Take Home Final Exam

Write definition for a class called Rainfall that will store the amount of
rainfall per month in array called rain.

The beginning of the clss is shown below.

public class Rainfall

{

private double[] rain; // Array to hold rainfall data

.

}

Your Rainfall class should have the following:

a) A constructor that will initialize the rain array using values from an

array that has 12 values for rainfall amount for 12 months of the year.
b) A method called getTotalRainfall to return the total rainfall for the year

total of all values in the rain array.
c) A method called getAverageRainfall to return the average of rainfall for

the year.
d) A method called getHighestMonth to return the month number that has the

highest rainfall for the year.
e) A method called getLowestMonth to return the month number that has the

lowest rainfall for the year.
f) A method called print to print all the rainfall amount for all months with

values separated by a blank or a tab.

Your test program can be something like this.

public class RainfallTest

{

public static void main(String[] args)

{

// Create an array of rainfall figures.

double[] thisYear = {1.6, 2.1, 1.7, 3.5, 2.6, 3.7,

3.9, 2.6, 2.9, 4.3, 2.4, 3.7 };

2

What to submit?

In a Word document:

Copy paste your Java code below this label

followed by your output.
Also, give link to your repl.it project if you used repl.it

Lastly, convert document to pdf format and submit this pdf file.

ONLY ONE file to be submiteed.

Leave a Comment

Your email address will not be published. Required fields are marked *