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
Briefly describe the concept of network topology change and explain how these can be dealt with using Routing Information Protoc
Natasha2012 [34]

Answer: network topology is the arrangement of nodes which includes routers and switches so that enables connection between the server and the client.

however due to times when there is huge traffic in the nodes there needs to be an optimal path for the exchange of information which is accomplished by different routing protocols.

Explanation:

Routing Information Protocol(RIP) is one such protocol which enables to route packets from the source to the destination having the least possible traffic along its path. There are two sets of routing algorithm which are

1. Static routing protocols

2. Dynamic routing protocols.

The difference between the two is that dynamic routing protocols helps to construct the routing tables dynamically as compared to static routing.

RIP is a type of dynamic routing whereby it sends the contents of its routing table the adjacent routers every 30 seconds and whenever a route is discarded from the routing table it is marked as unusable.

RIp is supported by almost all routers and also supports load balancing which is one of it advantages.

8 0
3 years ago
The main part of your program has the following line of code.
Angelina_Jolie [31]

Answer:

def divide(numA, numB):

  return numA / numB

Explanation:

5 0
2 years ago
Some of the users in your company create and delete so many files that they have problems with fragmented disks. Which of the fo
zavuch27 [327]

Answer:

D) extents

Explanation:

Disks fragmentations in computer science refers to the cases of a file system laying out its contents  in a non-continuous manner thus preventing an in-place alteration of the contents (that is the contents of the file are scattered in fragments across different location on the disk). Disk fragmentation is mostly associated with aging. To mitigate against this, modern implementation of file systems try to preallocate longer chunks of disk space, this is called extents, in this way fragmentation is avoided since a contiguous size of disk space is preallocated to the files and its contents stay together.

4 0
3 years ago
Calculate the time necessary to perform a multiply using the approach described in the text (31 adders stacked vertically) if an
Rudiy27

The time that will be used to perform a multiplication using the approach is 28 time units.

<h3>How to calculate time taken?</h3>

From the information given, the following can be noted:

A = 8 (bits wide)

B = 4 time units.

The multiplication will be performed based on the adder stack. Since A = 8, then, A - 1 = 8 - 1 = 7.

Now, the time taken will be:

= 7 × B

= 7 × 4tu

= 28 tu

In conclusion, the correct option is 28 time units.

Learn more about time taken on:

brainly.com/question/10428039

5 0
2 years ago
The execution of instruction is called.........................?​
sertanlavr [38]

Answer:

The execute cycle

Explanation:

Hope this helps

6 0
3 years ago
Read 2 more answers
Other questions:
  • Word processing programs have different view options that you can use depending on the tasks you’re performing. Which option hel
    11·1 answer
  • What are two great ways to find clues to locate commands on the ribbon?
    13·1 answer
  • Because public key encryption requires the use of two different keys, it is also known as _____ encryption
    13·1 answer
  • A difference between crt monitors and flat-panel displays is that most flat-panel displays use digital signals to display images
    8·1 answer
  • A water-sports company specializes in custom-made watercrafts and accessories.Their marketing manager decides to use the broad-m
    12·1 answer
  • Write an expression that computes the average of the values 12 and 40.
    6·1 answer
  • What will be the values of ans, x, and y after the following statements are executed? int ans = 35, x = 50, y =50; if ( x &gt;=
    7·2 answers
  • What's the full form of CPU?​
    5·2 answers
  • Difference between batabse and database management system
    5·1 answer
  • What is the purpose of each component ?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!