Find the Largest Volume Through an Abstract Type
easyQuestion 545Container is an abstract class with one abstract method, volume(). Crate and Barrel each compute it in their own way. Complete Warehouse.largestVolume, which receives an array typed as Container[] and never needs to know which kind each element is.
Requirements:
1. Return the largest volume() found in the array.
2. Return 0.0 for an empty array. largest already starts there.
3. Call volume() on each element. Do not test for Crate or Barrel.
Do not change Container, Crate or Barrel.
Do NOT write a main method.
Expected output
6.28 12.00
= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
Abstract ClassesClasses
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (sysout, psvm, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.