Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a RainFall class that stores the total rainfall for each of 12 months of a year into an array of doubles. The RainFall class

Write a RainFall class that stores the total rainfall for each of 12 months of a year into an array of doubles.

The RainFall class constructor method accepts an array of double values representing the amount of rainfall in inches per month.

The program should have 4 methods that return the following:

1) Total rainfall for the year

2) Average monthly rainfall

3) Month with the most rain

4) Month with the least rain

Other requirements that must be met!

FIELDS : monthNames : private java.lang.String[] monthNames

Values : private double[] values

Constructors : RainFall () : public RainFall(double[])

Methods :

getAverage(); public double

getLowestMonth() ; public (This is a String not the value of the month. Month name to be returned)

getHighestMonth ; public (This is a String not the value of the month. Month name to be returned)

getTotal ; public double

Use a String Array with an array initializer list to store the month :

names private String[] monthNames= {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};

OUTPUT:

UNIT TESTING

double[] d1 = {1.1,2.2,3.3,4.4,5.5,6.6,7.7,8.8,9.9,10.10,11.11,12.12} <-- the input

Total : 82.83

Average : 6.9025

HIghest Month : December

Lowest Month : January

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_2

Step: 3

blur-text-image_3

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

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions

Question

Data table

Answered: 1 week ago