Description
Write a Rule-Ell-due chart once the total rainfall for each of 12 months into an array of doubles. The program should have methods that return the following:
-
Total rainfall for this year;
-
The average monthly rainfall
-
The month with the most rain
-
The month with the least rain
The program should not accept negative numbers for monthly rainfall figures.
You may use the following main functions to test the methods:
public static void main(String[] args) { // Array with this year's rainfall data double[] thisYear = {16, 2, 1, 1, 7, 3, 5, 2, 6, 3, 7, 35, 2, 6, 25, 4, 52, 24, 53}; int high; // To hold the month with the highest amount int low; // To hold the month with the lowest amount // Display the total rainfall: System.out.println("The total rainfall for this year is "+ getToellRainFall(thisYear)); // Display the average rainfall: System.out.println("The average rainfall for this year is "+ getAverageRainFall(thisYear)); // Get and deploy the month with the highest rainfall: high = getHighSubMonthOnlyYear); System.out.println("The month with the highest amount of rain "+ "is "- (high+1) + "with "+ this year[high] + - "includes"); // Get and deploy the month with the lowest rainfall: } // end main }
Do not forget to use a proper style in your Rule-Ell_json file (including comments and a pre-tagree section at the top of the file).
Notes:
-
The program must compile without syntax errors; in the last case 50% of the assignment peaks will be deduced, even if your program is “essentially” correct.
-
To get that result for an assignment, your program must solve the assignment problem completely.
-
Please add comments to the source code. Your program should have a reasonable amount of comments.
-
At the very beginning of each file, there should be a block comment containing the student name, course number, and assignment number.
-
Follow the programming styles and guidelines discussed in class, such as using paragraph names for variables and exams case conventions for variables, classes, etc.