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 Built-in Java Classes/Methods 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 5 WaterBottle instances in an ArrayList of
the appropriate type in this order:
o StandardWaterBottles:
10 H and 0.7 R
1 default
o Thermos:
5 H and 0.5 R
1 default
6 H and 0.4 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 10.00, radius 0.70, and volume 15.39 and
is appropriate for LunchBag instances
A green water bottle with height 12.00, radius 2.00, and volume 150.80 and
is appropriate for LunchBag instances
A green water bottle with height 5.00, radius 0.50, and volume 3.93 and is
appropriate for LunchBox instances
A green water bottle with height 4.00, radius 0.90, and volume 10.18 and
is appropriate for LunchBox instances
A green water bottle with height 6.00, radius 0.40, and volume 3.02 and is
appropriate for LunchBox instances
Sorted:
A green water bottle with height 6.00, radius 0.40, and volume 3.02 and is
appropriate for LunchBox instances
4
A green water bottle with height 5.00, radius 0.50, and volume 3.93 and is
appropriate for LunchBox instances
A green water bottle with height 4.00, radius 0.90, and volume 10.18 and
is appropriate for LunchBox instances
A green water bottle with height 10.00, radius 0.70, and volume 15.39 and
is appropriate for LunchBag instances
A green water bottle with height 12.00, radius 2.00, and volume 150.80 and
is appropriate for LunchBag instances
Largest: A green water bottle with height 12.00, radius 2.00, and volume
150.80 and is appropriate for LunchBag instances
Smallest: A green water bottle with height 6.00, radius 0.40, and volume
3.02 and is appropriate for LunchBox instances

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 Programming Questions!