Question
I'd like help with coding this problem! Please and thanks. With the knowledge that you have gained about arrays, you are going to develop a
I'd like help with coding this problem! Please and thanks.
With the knowledge that you have gained about arrays, you are going to develop a program that utilizes an array of double values to produce a simple statistical report about the array contents.
Problem Description:
The Amateur Meteorologists Association (AMA) has heard about your work to develop programs related to weather information and has asked you to write a program that allows them to enter 12 months of rainfall information and to perform some statistical calculations on this information. The association would like to calculate for 1 year of rainfall the total for the year, the average for the year and to determine which month had the highest and lowest rainfall and what the highest and lowest amounts were. The association would like the program to print out a nicely formatted report of the 12 monthly amounts and all of these statistics.
Design Requirements:
Be sure the program that is developed meets the following coding and logic requirements. ? Be sure to develop a main method as a controlling method that calls the following
methods to perform the following separate tasks required in this program. After each of these methods have completed their work, then the data for the rainfall statistics report will be available in various variables in the main method and the report can be displayed by coding that is written in the main method.
o Method 1: A method that provides for keyboard input of the rainfall amounts, input validation of the input amounts and storage of the 12 monthly rainfall amounts in a newly created array that is returned to this methods calling statement in the main method. NOTE: Once this logic has been developed and successfully tested, you may comment out (not delete) the call to this method. You may then develop an array declaration statement that utilizes an array initialization list that contains the 12 different rainfall amounts that you are using to test the program. This will make testing of the remaining logic in the program easier without the tedious entry of 12 rainfall amounts. (Note: see the testing requirements section below for example rainfall amounts that you could use for testing.)
o Method 2: A method that accumulates all of the monthly rainfall amounts in the rainfall array. The array of rainfall amounts will need to be provided to this method via a parameter. This method will return the total amount of rainfall for the year to the methods calling statement in the main method.
o Method 3: A method that calculates the average monthly rainfall from the monthly rainfall amounts in the rainfall array that is provided to this method via a parameter and returns the monthly average to the methods calling statement in the main method. (HINT: This method will also need the total of all of the rainfall, which should be obtained from the method that totals all of the monthly rainfall amounts in the rainfall array. HINT-HINT: this will require a nested method call. While this average calculation could be done in
Page 1 of 4
the main method, you are required to demonstrate your skills with nested method calls and correct parameter passage and returned values between nested methods.)
o Method 4: A method that locates the largest rainfall amount in the array, which is provided to this method via a parameter and returns the index position of the largest amount to this methods call statement in the main method.
o Method 5: A method that locates the smallest rainfall amount in the array, which is provided to this method via a parameter and returns the index position of the smallest amount to this methods call statement in the main method.
? Be sure to develop within the main method the output statements that will output the statistical report that contains a listing of the 12 monthly rainfall amounts, the yearly total, the average rainfall for the year, the largest rainfall amount and month in which it occurred and the smallest rainfall amount and the month in which it occurred. (NOTE: This output logic does not need to be within a method that is separate from the main method, but if you utilize a separate method for this output task, then be aware that you will need to provide the method with data values for a number of parameters).
? Be sure to use appropriate and meaningfully named class and local variables and constants to hold the data values of the problem. (HINT: The number of months in a year is constant and will be referenced in most of the methods, so creating a class static constant is a preferred technique. Here is an example of how this type of variable would be written in the program outside and above the main method.)
final static int NUM_MONTHS = 12;
? Be sure to utilize good output formatting to display the monthly rainfall amounts and the yearly rainfall statistics with good data labels, 2 decimal positions for the rainfall amounts, and numeric columns that are right-aligned. Please review the example execution output to more fully understand the report output layout requirements.
? Each of the methods in the program must be documented using the JavaDoc commenting format that contain a method description, @param tags that describe any parameters and an @return tag that describes any returned value.
Testing Requirements:
The AMA has provided the following two sets of yearly rainfall amounts that can be used to test this program. It is recommended that after you have the input process developed and working in this program that you redesign the program to utilize an initialization list during the remaining development and testing of the program to reduce the tedious entry of test data during multiple testing attempts.
{1.05, 1.65, .85, .90, 2.36, .55, 4.10, 1.38, 2.78, 3.45, .35, 1.25} {.36, .85, 1.05, 3.25, 2.30, 1.75, .65, .25, 1.20, 2.40, 1.65, .90}
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