Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MonthJanuary February March High F)63 Low May June Ju 63 52 64 54 OctoberNovember December 67 55 65 6568 71 72 72 65 51 o55

image text in transcribedimage text in transcribedimage text in transcribed

MonthJanuary February March High F)63 Low May June Ju 63 52 64 54 OctoberNovember December 67 55 65 6568 71 72 72 65 51 o55 558 616365 70 63 62 //AverageTemperature.java public class AverageTemperature public String Month); public float High68.f; public float Low34.f; public AverageTemperature (String InMonth, float InHigh, float InLow) Month-InMonth; HighInHigh; Low = 1nLow; public String toString() return Month +" High is: " + High " Low is: " Low; //Client.java import java.uti1.ArrayList; import java.uti1.Collections; public class Client public static void main(String[] args) ArrayList temperatures new ArrayList(); temperatures.add (new AverageTemperature( "January", 63, 51)); temperatures.add (new AverageTemperature( "February", 63, 52)); temperatures.add (new AverageTemperature("March", 64, 54)); Collections.sort(temperatures); System.out.println(temperatures); Create 2 source files (AverageTemperature.java and Client.java) and try running the code Why is there a problem? (provide answer to the question in the submission commentary box) Implement the Comparable interface in AverageTemperature class so that months are ordered based on the high temperature, and ties are broken by low temperature. Modify the client code so that missing moths are added to the temperatures array. Make sure that the output has months in the ascending order from lower to higher temperature. 1. 2. 3. Lightsho Scree

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

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions

Question

1. In what ways has flexible working revolutionised employment?

Answered: 1 week ago