Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello this is my first java project and i need help. Thank you in advanced for a

ID: 3663439 • Letter: H

Question

Hello this is my first java project and i need help. Thank you in advanced for all your answers and reply to this

First, read in rainfall values from the user.

Read in twelve values tor represent the amount of rainfall for each of the 12 months.

Do not accept negative numbers (since this does not make sense for rainfall).

Store the values in a local array.

Note: the array should be declared in the main method, not as a static variable outside of main.

Second, offer a menu of options to the user.

The menu should let the user choose between six actions (described in 3-8)

For each action, write a method to accomplish that action.

Write a method to output the rainfall for each month.

Write a method to find the total rainfall for the year.

Note: because the array was declared in main, you will need to pass it as a variable to this and all other methods.

Write a method to find the average monthly rainfall.

Write a method to return the name of the month with the most rain.

Note: if two months have the same maximum value, you can output either month.

Write a method to return the name of the month with the least rain.

Note: if two months have the same minimum value, you can output either month.

Write a method to update the amount of rain in any given month.

Notes:

Your code should be in a single class and should contain at least seven methods (main plus the six required methods).

You can also write additional helper methods.

Each method is worth 10 points. The remainder of the points will be awarded for general style and approach.

You will receive no credit for files that do not compile.

For full credit, follow good principles of object-oriented programming, method design, and naming conventions.

Use constants when possible and avoid duplicating code.

Hint: think about whether you can use an array of month names to simplify code and avoid duplicating code.

Consider using switches in addition to conditionals.

I provided a sample output file (using 2014-2015 data from http://ggweather.com/sf/monthly.html).

Your program does not have to run exactly like mine, but you can use this as a guide for what the output might look like and the different tests you should run to make sure your program works properly.

Explanation / Answer

Anything Requied please do comment

public class rainFall
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
final int SIZE = 12;
double[] monthlyRain = new double[SIZE];
System.out.println("Enter the monthly rain fall amount: ");
int i = 0;
for(i = 0; i < SIZE; i++)
{
do
{
System.out.print("Month " + (i+1) + ": ");
monthlyRain[i] = keyboard.nextDouble();
}
while(monthlyRain[i] < 0);
}
System.out.println("The annual sum of rain: " + sumRain(monthlyRain));
System.out.println("The average sum of rain: " + averageRain(monthlyRain));
System.out.println("The most amount of rain fall: " + mostRain(monthlyRain));
System.out.println("The least amount of rain fall: " + leastRain(monthlyRain));
}
static double sumRain(double[] array)
{
double sum = 0;
for(int i = 0; i < array.length; i++)
{
sum += array[i];
}
return sum;
}
static double averageRain(double[] array)
{
double average = 0;
average = sumRain(array)/array.length;
return average;
}
static double mostRain(double[] array)
{
double most = 0;
for (int i = 0; i < array.length; i++)
{
if(array[i] > most){
most = array[i];
}
}
return most;
}
static double leastRain(double[] array)
{
double least = array[0];
for(int i = 0; i < array.length; i++)
{
if(array[i] < least)
{
least = array[i];
}
}
return least;
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote