What is orographic rainfall?

Rainfall array program?

  • Below is a partially written program named Rainfall.java that stores the total rainfall for each of 12 months into an array of doubles and then produces output about the rainfall data. It is your job to complete the program: 1) The program should have the following 4 methods that return values: the total rainfall for the year: totalRain (returns a double) the average monthly rainfall: averageRain (returns a double) the month with the most rain: mostRain (returns an int - the index of the array) the month with the least rain: leastRain(returns an int - an index of the array) 2) In addition, the program uses (and you must write) a method that prompts the user and then stores input into the array. This method does not return any values. Name the method: initRain 3) Note:Each of the five methods you will write is public static and each takes the array as an argument. 4) The output should display only one digit after the decimal place. You must write five methods for the program. You must use an array parameter in the methods. Enter rain fall for month 1: 10.1 Enter rain fall for month 2: 11.2 Enter rain fall for month 3: 12.3 Enter rain fall for month 4: 13.4 Enter rain fall for month 5: 14.5 Enter rain fall for month 6: 15.6 Enter rain fall for month 7: 5.1 Enter rain fall for month 8: 6.2 Enter rain fall for month 9: 7.3 Enter rain fall for month 10: 8.4 Enter rain fall for month 11: 9.5 Enter rain fall for month 12: 10.0 The total rainfall for this year is 123.6 The average rainfall for this year is 10.3 The month with the highest amount of rain is 6. The month with the lowest amount of rain is 7.

  • Answer:

    First, you better understand how to ask for help. Any I want you to be happy. public class Rainfall { final static int SIZE = 12; public static double totalRain(double []x) { double s=0; for(int i=0;i<x.length;i++) s+=x[i]; return s; } public static double averageRain(double []x) { return totalRain(x)/x.length; } public static int getHighest(double []x) { double s=x[0];int id=0; for(int i=1;i<x.length;i++) if(s<x[i]) { s=x[i]; id=i;} return id; } public static int getLowest(double []x) { double s=x[0]; int id=0; for(int i=1;i<x.length;i++) if(s>x[i]) { s=x[i]; id=i;} return id; } public static void main (String [] args) { double highest = 0; double lowest = 0; double total = 0; double average=0; double [] rainfall = new double [SIZE]; initialize_array (rainfall); highest = getHighest (rainfall); lowest = getLowest (rainfall); total = getTotal (rainfall); average=averageRain(rainfall); System.out.println(average); } public static void initialize_array (double [] rain) { Scanner S=new Scanner(System.in); for (int i = 0; i<rain.length;i++) { System.out.println("Enter rainfall for month"+(i+1)); rain[i]=S.nextDouble(); } } }

ihaven0c... at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.