Count Ready Items Through an Interface Array
easyQuestion 530Checkable is an interface with one method, isReady(). FuelTank and Hatch implement it in different ways. An array of type Checkable[] can hold any mix of objects whose classes implement the interface. Complete the loop in Launch.countReady.
Requirements:
1. countReady(Checkable[] items) returns how many of the items report true from isReady().
2. An empty array gives 0.
3. Call isReady() on each item. Do not test which class an item is: the tests add kinds of Checkable that are not in this file.
4. Do not change Checkable, FuelTank or Hatch.
Do NOT write a main method.
Expected output
2 of 4 ready= newline. The output ends with a newline, so print one after the last line.
Hints2 available
Sign in to use hintsTopics
InterfacesClasses
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.