Question: JAVA CODING Exercise-1: Rainfall Statistics (50 pts) Write a program that asks user the total rainfall for the last six months of two consecutive years

JAVA CODING

JAVA CODING Exercise-1: Rainfall Statistics (50 pts) Write a program that asksuser the total rainfall for the last six months of two consecutive

Exercise-1: Rainfall Statistics (50 pts) Write a program that asks user the total rainfall for the last six months of two consecutive years and do the following: 1. the total rainfall per year 2. the average monthly rainfall (for two years) 3. the month with the most rain (per year) You need to break your code into the following methods: run: It asks the user to enter the year and rainfall values for each month (last six months) and reads the input as a double from the keyboard. It calls isValid method for validity check of the year. If isValid method returns true, then program will ask for the rainfall values from July to December for that year. Each time user will enter the rainfall values; isValid method will be called to check for the validity of the input. Once, the user enters all the required input, and then the method will show the output in the format as shown above. isValid: It returns true in the following scenario: (1) year should greater than 1990. (2) The monthly rainfall cannot be negative Otherwise, it returns false. Exercise 2: (30 pts) Add a code segment to the code that you complete in Exercise1 to do the following: 1) Display the year that received the most rain. Expected Output: Enter the year: 2018 Enter the rainfall for July, 2018: 2.03 Enter the rainfall for August, 2018: 1.77 Enter the rainfall for September 2018: 8.44 Enter the rainfall for October 2018: 7.04 Enter the rainfall for November 2018: 7.46 Enter the rainfall for December 2018: 9.74 Enter the year: 2019 Enter the rainfall for July, 2019: 0.73 Enter the rainfall for August, 2019: 1.07 Enter the rainfall for September. 2019: 3.60 Enter the rainfall for October, 2019: 4.05 Enter the rainfall for November, 2019: 0.53 Enter the rainfall for December 2019: 1.13 Total rainfall of months: 12 Total rainfall for 2018: 36.48 Total rainfall for 2019: 11.11 Average rainfall per month: 4.0575 The month with the most main for 2018: December The month with the most main for 2019: October 2018 received the most rainfall

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!