Question: Utilizing Built - in Java Classes / Methods Update your test class to instantiate some WaterBottles, sort them, and then find largest and smallest of
Utilizing Builtin Java ClassesMethods Update your test class to instantiate some
WaterBottles, sort them, and then find largest and smallest of the set.
Additional Requirements
Modify your WaterBottleTest class to create WaterBottle instances in an ArrayList of
the appropriate type in this order:
o StandardWaterBottles:
H and R
default
o Thermos:
H and R
default
H and R
Using iteration loops print information about each instance to the console.
Use java.util.Collections.sort to sort the list and reprint information for each instance.
Use java.util.Collections.min and max to find the largest and smallest
WaterBottles and print their information to the console.
Submit your WaterBottle, StandardWaterBottle, Thermos, and WaterBottleTest classes
and the Drinkable interface to Gradescope.
Expected Output
A green water bottle with height radius and volume and
is appropriate for LunchBag instances
A green water bottle with height radius and volume and
is appropriate for LunchBag instances
A green water bottle with height radius and volume and is
appropriate for LunchBox instances
A green water bottle with height radius and volume and
is appropriate for LunchBox instances
A green water bottle with height radius and volume and is
appropriate for LunchBox instances
Sorted:
A green water bottle with height radius and volume and is
appropriate for LunchBox instances
A green water bottle with height radius and volume and is
appropriate for LunchBox instances
A green water bottle with height radius and volume and
is appropriate for LunchBox instances
A green water bottle with height radius and volume and
is appropriate for LunchBag instances
A green water bottle with height radius and volume and
is appropriate for LunchBag instances
Largest: A green water bottle with height radius and volume
and is appropriate for LunchBag instances
Smallest: A green water bottle with height radius and volume
and is appropriate for LunchBox instances
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
