Question: Hi, please help me with this Java code. Thanks Write a program that calculates the average rainfall for three months. The program should ask the

Hi, please help me with this Java code. Thanks

Hi, please help me with this Java code. Thanks Write a program

Write a program that calculates the average rainfall for three months. The program should ask the user to enter the name of each month, such as June or July, and the amount of rain (in inches) that fell each month. The program should display a message similar to the following:

The average rainfall for June, July, and August is 6.72 inches.

NOTE: You MUST use the Scanner class to read input from the us

AverageRainfallProjectjava 3 2 import java.util.Scanner; 4 public class AverageRainfallProject 5 public static void main (String [] args) 6 7 8 9 Scanner scanner new Scanner (System.in); double sum-0.0; double average-0.0; String month1, month2, month3; double rainl, rain2,rain3; 10 12 14 15 16 17 18 19 20 System.out.println( "Enter the name of the month 1: "); month1 = scanner.nextLine(); System.out.println("Enter the rainfall (in inches): "); rain1- scanner.nextDoublek System.out.println("Enter the name of the month 2: "); month2scanner.nextLine() System.out.println("Enter the rainfall (in inches): "); rain2 scanner.nextDouble(); System.out.println( "Enter the name of the month 3: "); month3 scanner.nextLine(); System.out.println("Enter the rainfall (in inches): "); rain3scanner.nextDouble(); 23 24 25 26 27 28 29 30 31 32 average -(double)(rain1+ rain2+ rain3)/3; System.out.println("The average rainfall for " monthl + "," + month2and"month3 is"average)

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!