Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java --- Write a method to summarise daily tempratures. The details are given as follow. - The method will receive an array of doubles. Each

Java ---

Write a method to summarise daily tempratures. The details are given as follow.

- The method will receive an array of doubles. Each number in the array represents the temperature of a day.

- If there are less than 10 temperatures recorded, the method will not perform any calculation. Instead, it will print a message "Insufficient data".

- If there are 10 or more temperature recorded, the method will calculate:

-- the average temperature

-- the highest temperature

-- the number of cool days in which the temperatures are 20 or below

-- the number of warm days in which the temperatures are 21 to 30 (inclusive)

-- the number of hot days in which the temperatures are 31 and above.

- Upon completion, the method will print the following:

-- the number of cool days

-- the number of warm days

-- the number of hot days

-- the average temperature

-- the highest temperature

You may assume the array is not empty. You can make use of the following code snippet to write your answer:

---------------------------------------------

public static void getSummary (double [ ] temperatures)

{

//write your code here

}

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2018 Dublin Ireland September 10 14 2018 Proceedings Part 1 Lnai 11051

Authors: Michele Berlingerio ,Francesco Bonchi ,Thomas Gartner ,Neil Hurley ,Georgiana Ifrim

1st Edition

3030109240, 978-3030109240

More Books

Students also viewed these Databases questions