Question: Write a Java class that has the following fields: an array of double type called rainfall with a size of 7 that stores the rainfall

Write a Java class that has the following fields: an array of double type called rainfall with a size of 7 that stores the rainfall amount in inches for the next seven days of the week (where the first index corresponds with Monday, the second with Tuesday, etc.) a parallel array of String type called days with a size of 7 that stores the name of the day (for example, the first item in the array is 'Monday', second item is 'Tuesday', etc.) The class should also have the following methods: a method called rainfallAverage that accepts the rainfall array as a parameter and calculates and returns the average rainfall for the week (1 decimal place) a method called highestRainfall that accepts the rainfall array and the days array as parameters, and determines and displays the day with the highest rainfall. a method called lowestRainfall that accepts the rainfall array and the days array as parameters, and determines and displays the day with the lowest rainfall. The main method in the program should ask the user for 7 days of rainfall (use double types and in the order of the days of the week starting with Monday. As the user is entering all 7 inputs, make sure to place entries into the rainfall array and call the 3 methods mentioned above, printing out the average rainfall, the day with the highest rainfall, and the day with the lowest rainfall, each on a separate line.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!