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]
2 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]2 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
What addresses do not change if you copy them to a different cell?
Anika [276]

Answer: absolute then relative

Explanation:

7 0
2 years ago
When a user problem cannot be solved by the help desk at the first level of resolution, the problem is ___________ to the second
PIT_PIT [208]

Answer: escalated

Explanation:

7 0
2 years ago
PLEASE HELP
Zinaida [17]

Answer:

B from you search question carefully and identify the key word

Explanation:

3 0
3 years ago
Read 2 more answers
Some commands listed in a menu cannot be selected.<br><br><br> True or False
bogdanovich [222]
True! Have a nice week
4 0
2 years ago
Read 2 more answers
I made a fish emoji what do you think &gt;{'_'}&lt; should I change anything
Anvisha [2.4K]

Answer: It is beautiful

Explanation:

3 0
2 years ago
Read 2 more answers
Other questions:
  • Why are many otherwise safety-conscious people victims of Internet crime?
    13·1 answer
  • Frank works for an organization that wishes to install a software program on a single server with multiple users connected. Whic
    8·2 answers
  • ____ is a utility that can verify that TCP/IP is installed, bound to the NIC, configured correctly, and communicating with the n
    11·1 answer
  • Charles would like to move his internet browser window so that he can see his desktop.He should
    5·1 answer
  • Software is nothing but a piece of code or set of instructions written in a chip to run a hardware device on the Computer. O Tru
    14·1 answer
  • ____ are designed to be used with everyday objects, such as home appliances, gaming consoles, digital cameras, e-readers, digita
    12·1 answer
  • PLZ HELP ASAP
    13·1 answer
  • Mario kart is mercedes lol
    13·2 answers
  • A user generates printouts consisting of several pages of seemingly random characters every time he prints to a network printer.
    5·1 answer
  • Which tools can help you gather information about the processes running on a windows operating system?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!