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
NemiM [27]
4 years ago
11

Design a program that lets the user enter the total rainfall for each of 12 months into a list. The program should calculate and

display the total rainfall for the year, the average monthly rainfall, the months with the highest and lowest amounts.
Computers and Technology
1 answer:
aleksandrvk [35]4 years ago
8 0

Answer:

import java.util.Arrays;

import java.util.Scanner;

public class num1 {

   public static void main(String[] args) {

       Scanner in = new Scanner (System.in);

      int []monthlyRainfall = new int [12];

       System.out.println("Enter rainfall for January");

       monthlyRainfall[0]= in.nextInt();

      for(int i = 1; i<monthlyRainfall.length; i++){

          System.out.println("Enter rainfall for the next Month");

          monthlyRainfall[i]= in.nextInt();

      }

       System.out.println("The complete list is:");

       System.out.println(Arrays.toString(monthlyRainfall));

       //Calculating the total and average rainfall

       int totalRainfall =0;

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

           totalRainfall+=monthlyRainfall[i];

       }

       System.out.println("Total rainfall is "+ totalRainfall);

       System.out.println("Average rainfall is "+(totalRainfall/12));

       // finding the lowest rainfall

       int min = monthlyRainfall[0];

       int minMnth =0;

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

           if(min>monthlyRainfall[i]){

              min = monthlyRainfall[i];

               minMnth =i+1;

           }

       }

       System.out.println("The minimim rainfall is "+min);

       System.out.println("The month with the minimum rainfall is "+minMnth);

       // finding the highest rainfall

       int max = monthlyRainfall[0];

       int maxMnth =0;

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

           if(max<monthlyRainfall[i]){

               max = monthlyRainfall[i];

               maxMnth = i+1;

           }

       }

       System.out.println("The maximum rainfall is "+max);

       System.out.println("The month with the maximum rainfall is "+maxMnth);

   }

}

Explanation:

  • Create an array to hold the list of monthly rainfall from january to December int []monthlyRainfall = new int [12];
  • Prompt user to enter the values for the monthly rainfall and fill up the array with the values using a for loop
  • Print the populated List
  • Use a for loop to calculate the Total rainfall by adding elements from index 0-11
  • Calculate the average rainfall totalrainfal/12
  • Using a for loop, find the maximum and minimum values in the array
  • The index of the minimum value plus 1 Gives the month with the lowest rainfall
  • The index of the maximum value +1 gives the month with the highest value
You might be interested in
If you have a Gmail account, you automatically have a Google+ account
Korolek [52]
The statement above is TRUE.
According to Google operating system, new users who signed up for google account will automatically get a gmail and google plus accounts. User can later delete the google plus account if they are not interested in it.
5 0
3 years ago
KAILANGAN ANG MASIDHI AT MALAWAKANG PAGBABASA NA SIYANG MAKAPAGBUBUKAS NG DAAN SA LAHAT NG KARUNUNGAN AT DISIPLINA TULAD NG AGHA
Goryan [66]

Answer:

Oo, tama ka!

Brainiliest?

7 0
3 years ago
Componets of computer
Temka [501]

The four components of computer are explained clearly.

<u>Explanation:</u>

  • Hardware is the electrical physical parts that a computer system needs to function. It organizes all the process  by a circuit board that operates within a PC or laptop; built with the "motherboard", "graphics card", "CPU (Central Processing Unit)", "ventilation fans", "webcam", "power supply", and so on. Without hardware, there is no means of running the necessary software that makes computers so valuable.
  • Software is a program that facilitates a computer to execute a particular task, as objected to the hardware. Computer software has to be "stored" into the computer's storage (such as a hard drive, memory, or RAM). Working computer systems segment software into three major classes: system software, programming software, and application software.
  • A user is a person who handles a computer or network service. Users of computer and software output regularly require the technical expertise needed to fully know how they operate.
  • Data is defined as bases or figures, or knowledge that's saved in or utilized by a computer. This data will be in the form of text documents, images, audio clips, software programs, or other types of data. Computer data may be prepared by the CPU and are saved in files and folders on the hard disk.
3 0
4 years ago
HURRY IM TIMED Note that common skills are listed toward the top, and less common skills are listed toward the bottom. According
Sloan [31]

Answer:

1 and 3 are the answers

4 0
3 years ago
Read 2 more answers
Thank you very much for your email. ...... was very interesting​
Fynjy0 [20]

Answer:

hi everyone how was your day :)

Explanation:

6 0
4 years ago
Other questions:
  • The management of Ventura Inc. approves the purchase of a few computers for the sales team. The management wants only the most b
    8·1 answer
  • g Create a public non-final generic class called YourSimpleLinkedList. You should extend SimpleLinkedList which is parameterized
    10·1 answer
  • Which of these tools can best be used as a self assessment for career planning purposes
    12·1 answer
  • Write a function decimalToBinaryRecursive that converts a decimal value to binary using recursion. This function takes a single
    11·1 answer
  • Make a java program to enter a two-digit integer and determine if both digits are prime
    6·1 answer
  • Write the following function without using the C++ string class or any functions in the standard library, including strlen(). Yo
    8·1 answer
  • Do you like Houseparty?
    7·1 answer
  • Declare a structure whose tag name is Server and that contains the following fields: manufacturer, a string, model and serialnum
    12·1 answer
  • A large number of consecutive IP addresses are available starting at 198.16.0.0. Suppose that four organizations, Able, Baker, C
    11·1 answer
  • Which display technology was developed by apple, produces vibrant colors, and supports viewing from all angles?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!