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
You write a short story, but you want to make sure your work is protected before you post it online. What should you do to help
Mars2501 [29]
Make sure you but no copyright, author, and date of publication, that may help.
8 0
3 years ago
Differences between analog computer and hybrid computer​
aleksandrvk [35]

Answer:

Analog computers only work with continuous numerical data in analog quantities, digital computers can process both non-numerical and numerical data and a hybrid computer is a combination of both analog and digital. A hybrid computer has the accuracy of a digital computer paired with speed of an analog one.

5 0
3 years ago
Read 2 more answers
The capacity of a communication channel is measured in _______.
PSYCHO15rus [73]
<span>The capacity of a communication channel is measured in gb and gps.</span>
4 0
3 years ago
Read 2 more answers
JAVA
butalik [34]

Answer:

import java.util.*;

public class MyClass {

   public static void main(String args[]) {

       Scanner input = new Scanner(System.in);

       System.out.print("Input a word: ");

       String userinput = input.nextLine();

       for(int i =0;i<userinput.length();i+=2) {

           System.out.print(userinput.charAt(i));

       }

   }

}

Explanation:

This line prompts user for input

       System.out.print("Input a word: ");

This declares a string variable named userinput and also gets input from the user

       String userinput = input.nextLine();

The following iterates through every other character of userinput from the first using iteration variable i and i is incremented by 2

       for(int i =0;i<userinput.length();i+=2) {

This prints characters at i-th position

           System.out.print(userinput.charAt(i));

5 0
2 years ago
PLS HELP MEE!!!
kramer

Answer:

starting with lowercase letters, using uppercase letters for the first letter in a new word

Explanation:

starting with a dollar sign, using lowercase for the remaining parts of each word

4 0
2 years ago
Other questions:
  • How can you differentiate between standard and protocol? Write at least on example of each of these terminologies?
    12·1 answer
  • Consider the class Money declared below. Write the member functions declared below and the definition of the overloaded +. Modif
    13·1 answer
  • can An intelligent workplace uses technology to allow workers to be productive whether they are in the office or working from ho
    12·1 answer
  • write a function that takes a string as parameter, return true if it’s a valid variable name, false otherwise. You can use keywo
    6·1 answer
  • Demand is created through meeting customer buying criteria, credit terms, awareness (promotion) and accessibility (distribution)
    10·1 answer
  • Computer privacy typically occurs when which of the following is violated?
    6·1 answer
  • While using a web-based order form, an attacker enters an unusually large value in the Quantity field. The value he or she enter
    15·1 answer
  • Neview of related literature happens in two wayo (1) Traditional and
    6·1 answer
  • Which family does Ms word 2007 belongs to?​
    6·2 answers
  • How has the internet improved business communication worldwide
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!