Question: The code for a class sa 1 1 oons has been started below. salloons depends on the class sa 1 1 discussed in the previous

The code for a class sa11oons has been started below. salloons depends on the class sa11 discussed in the previous question.
A complete class ea11 is provided within the testing environment, so you should not add sall to the answer box below.
Follow the links below to find the specifications of a constructor and two further methods that you should add to the code already given.
(a) Balloons: public balloons()
Constructor for objects of class balloons. Initilises balloons to a suitable collection type.
(b) categoriseBalloons: publc SortedMap> categoriseBalloons()
Creates and returns a sorted map view of balloons. The keys are three categories of balloon ( in alphabetical order)
Large ( diameter greater than 10)
Medium ( diamater between 5 and 10(inclusive))
Small ( diameter less than 5)
Each of the associated values is a collection of ball objects that have diameters in the specified ranges, sorted by diameter from smalles to largest
Returns: the sorted map
(c) sumDiameters: public int sumDiameters(SortedMap> aSortedMap)
Sums rhe diameters of all the balloons in the given map. Note that other size categories may be introduced at a later date and this method should continue to work, regardless of the number of keys in the map.
Parameters: aSortedMap- a sorted map from ball sises to sorted sets of balls
Returns: the sum of the diameters of all the balloons in the given map.
Make any other alterations to the Balloons class required to implement the above methods.
 The code for a class sa11oons has been started below. salloons

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!