Answered step by step
Verified Expert Solution
Link Copied!

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 1: 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 2: 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 3: 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 4: 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 5: 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 6: 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 main(String[] 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
* data1: 1,2,3,4,5,6,7,8,9,10,11,12
* data2: 12,11,10,9,8,7,6,5,4,3,2,1
* data3: 15,20,8,0,12,30,5,22,12,7,10,2
*/
addRainfallData();
System.out.println("The average rainfall for the year was "+averageRainfall()+" inches."); //answers: data1:6.5, data2:6.5, data3:11.91666....
System.out.println("The lowest rainfall recorded for any month was "+lowestRainfallAmount()+" inches");//answers: data1:1, data2:1, data3:0
System.out.println("The name of the month with the lowest recorded rainfall was "+lowestRainfallMonth());//answers: data1:January , data2:December, data3:April
System.out.println("The highest rainfall recorded for any month was "+highestRainfallAmount()+" inches");//answers: data1:12, data2:12, data3:30
System.out.println("The name of the month with the highest recorded rainfall was "+highestRainfallMonth());//answers: data1:December , data2:January, data3: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 -1.0;
}
/**
* 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 -1;
}
/**
* 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 -1;
}
/**
* 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

2. Use the OHRP Web site to access and read the Belmont Report.

Answered: 1 week ago

Question

Define Administration and Management

Answered: 1 week ago

Question

Define organisational structure

Answered: 1 week ago

Question

Define line and staff authority

Answered: 1 week ago

Question

Define the process of communication

Answered: 1 week ago

Question

Explain the importance of effective communication

Answered: 1 week ago

Question

7. What decisions would you make as the city manager?

Answered: 1 week ago

Question

8. How would you explain your decisions to the city council?

Answered: 1 week ago