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.

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

You didn't find what you were looking for? Upload your specific requirements now and relax as your preferred tutor delivers a top quality customized paper

Order Now