1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Iteru [2.4K]
3 years ago
5

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 then display the average of the three rainfall amounts, rounded to 2 decimal places.
Computers and Technology
1 answer:
Eduardwww [97]3 years ago
8 0

Answer:

import java.util.Scanner;

public class ANot {

   public static void main(String[] args) {

   Scanner input = new Scanner(System.in);

       System.out.println("Enter the month name:");

       String month1 = input.next();

       System.out.println("Enter the amount of rain for "+month1);

       double month1Rain = input.nextDouble();

       System.out.println("Enter the second month: ");

       String month2 = input.next();

       System.out.println("Enter the amount of rain for "+month2);

       double month2Rain = input.nextDouble();

       System.out.println("Enter the Third month: ");

       String month3 = input.next();

       System.out.println("Enter the amount of rain for "+month3);

       double month3Rain = input.nextDouble();

       double averageRainfall = (month1Rain+month2Rain+month3Rain)/3;

       System.out.printf("Average Rainfall is: %,.2f  ", averageRainfall);

   }

}

Explanation:

This is written in Java Programming language

  1. Import  the scanner class to prompt user for the inputs (Months and amount of rainfall for each month)
  2. Find the average of the three rainfall amount by adding up and dividing by 3
  3. Output the average. Pay particular attention to the use of java's printf in order to print the average to 2 decimal places
You might be interested in
_____ is the software that protects you computer from harmful files, Trojan horses, and worms.
Bumek [7]
I think it's antivirus because Antivirus means to protect your computer from a deadly virus
4 0
4 years ago
Read 2 more answers
On the road you are traveling, the pavement markings change from broken white lines to solid white lines between the lanes of tr
Reil [10]
A solid white line means no passing or changing lanes. Hope this helps.
5 0
3 years ago
Which window allows you to view and change your computer's system information and settings?
ZanzabumX [31]
I think Its control panel
4 0
4 years ago
Read 2 more answers
What is used to accurately position objects on the slide using a single horizontal and vertical line that intersects in the cent
oksian1 [2.3K]

Answer: Grids are a set of static horizontal and vertical lines with several intersection points that appear when you enable them on the slide. They can be used to accurately place or position the objects to bring out the visual feel on a slide.

8 0
3 years ago
Read 2 more answers
A gamer typing their name into the computer is an example of:
vova2212 [387]

user input I think I'm not sure though

3 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following represent features of
    6·1 answer
  • if your computer is frozen, what is something you would do to troubleshoot the problem? A. check if the monitor is plugged in B.
    15·2 answers
  • Write a C program that creates two threads to run the Fibonacci and the Runner processes. Threads will indicate the start and th
    14·1 answer
  • Though it is seen as a last resort bankruptcy allows a consumer to
    6·1 answer
  • The name of a Variable effects its value<br><br> True<br><br> False
    7·1 answer
  • Assume you need to test a function named max. The function max receives two int arguments and returns the larger. Write the defi
    6·1 answer
  • A database record can best be described as:
    11·1 answer
  • Using the same Apple ID for multiple devices will definitely sync them all together <br> True/False
    7·2 answers
  • Select the correct answer from each drop-down menu.
    10·1 answer
  • I need help 50 points and brainiest if you answer
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!