Answered step by step
Verified Expert Solution
Question
1 Approved Answer
We are tasked with developing a system that records and manages rainfall data. The system will track one year's data, with individual numbers for each
We are tasked with developing a system that records and manages rainfall data. The system will track one year's data, with individual numbers for each month.
Tasks
Task : The system will ask the user to enter an integer for each of the twelve months in order, with a message that lets the user know the name of the month that the data is for. If the user wishes to cancel this input process, they can enter x instead of an integer. Complete the method public static boolean addRainfallData to complete this task. See the method comments for more detail.
Task : The system will compute and return the average rainfall. Complete the method public static double averageRainfall to complete this task. See the method comments for more detail.
Task : The system will determine and return the numeric value of the lowest rainfall of the twelve collected. Complete the method public static int lowestRainfallAmount to complete this task. See the method comments for more detail.
Task : The system will determine and return the name of the month with the lowest rainfall of the twelve collected. Complete the method public static String lowestRainfallMonth to complete this task. See the method comments for more detail.
Task : The system will determine and return the numeric value of the highest rainfall of the twelve collected. Complete the method public static int highestRainfallAmount to complete this task. See the method comments for more detail.
Task : The system will determine and return the name of the month with the highest rainfall of the twelve collected. Complete the method public static String highestRainfallMonth to complete this task. See the method comments for more detail.
SAMPLE CODE
We are tasked with developing a system that tracks the rainfall in a region for a year.
The total rainfall for each month is stored in a integer array. January's total rainfall
is stored in the first index position of the array, February's total rainfall is in the
second index position of the array, etc.
Because our RainfallTracker will be used by another system, we must use the methods exactly as defined
package assignment;
import java.util.Scanner;
public class RainfallTracker
public static void mainString args
Main is only for testing your code.
We will test your assignment on a set of different data, so it is NOT sufficient to simply return these results in all cases!
Data you can use to test your assignment
data:
data:
data:
addRainfallData;
System.out.printlnThe average rainfall for the year was averageRainfall inches."; answers: data: data: data:
System.out.printlnThe lowest rainfall recorded for any month was lowestRainfallAmount inches";answers: data: data: data:
System.out.printlnThe name of the month with the lowest recorded rainfall was lowestRainfallMonth;answers: data:January data:December, data:April
System.out.printlnThe highest rainfall recorded for any month was highestRainfallAmount inches";answers: data: data: data:
System.out.printlnThe name of the month with the highest recorded rainfall was highestRainfallMonth;answers: data:December data:January, data:June
This method computes the average rainfall for the year. Use a for loop
Recall that average is the sum of the array values divided by the number count of values.
@return a double for the computed average
public static double averageRainfall
return ;
This method finds the smallest value in the rainfall array
@return the integer of the lowest rainfall in the array
NOTE: Assume that the values in the array are all unique
public static int lowestRainfallAmount
return ;
This method finds the name of the month that matches the smallest value in the rainfall array
@return the name of the month with the lowest rainfall in the array.
NOTE: Assume that the values in the array are all unique
public static String lowestRainfallMonth
return null;
This method finds the largest value in the rainfall array
@return the integer of the largest rainfall in the array
NOTE: Assume that the values in the array are all unique
public static int highestRainfallAmount
return ;
This method finds the name of the month that matches the largest value in the rainfall array
@return the name
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started