Question
A 2 dimensional array will be created to store the amount of rainfall in New Jersey, New York and Pennsylvania over 12 months. The array
A 2 dimensional array will be created to store the amount of rainfall in New Jersey, New York and Pennsylvania over 12 months. The array will have 3 rows and 12 columns.
The amount of rainfall for each month will be entered by the user. T
he program will:
* Print a table showing the amount of rainfall by state and month (see sample output)
*Print the total rainfall by state
*Print the highest amount of rainfall on any one month and the corresponding state.
The main method should call all methods. The suggested methods are:
*createArray creates the array; asks the user for values; stores the values in the array; returns the array
*printRainfall prints the total rainfall entered by the user for each month by state as shown in sample output
*printTotalRainfall prints the total rainfall for each state as shown in the sample output
*printHighest returns the highest rainfall and the name of its corresponding state
Sample output:
Enter 12 months of rainfall in inches for New Jersey
1 2 3 4 5 6 0 0 5 10 5 3
Enter 12 months of rainfall in inches for New York
2 2 3 4 6 0 0 0 0 12 4 2
Enter 12 months of rainfall in inches for Pennsylvania
1 1 2 5 8 0 1 0 0 8 4 5
State Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
New Jersey 1 2 3 4 5 6 0 0 5 10 5 3
New York 2 2 3 4 6 0 0 0 0 12 4 2
Pennsylvania 1 1 2 5 8 0 1 0 0 8 4 5
New Jersey Total Rainfall: 44.0
New York Total Rainfall: 35.0
Pennsylvania Total Rainfall: 35.0
The highest rainfall on any month is 12 inches in New York
Please note the following requirements and how the assignment will be graded:
*Include a comment at the start of the program with the following (5 points): + A description of the program
* Include a comment at the start of every method (5 points)
*createArray creates and returns an array with all values entered by the user to the main method (10 points)
*printRainfall prints the values entered by the user as a formatted table showing the names of the states and the months (10 points)
*printTotalRainfall calculates and prints the total amount of rainfall over twelve months by each state (10 points)
*printHighest finds and prints the highest rainfall in any month and the name of the state (10 points)
*Good style used indentation, variable and methods name in camel case. (5 points)
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