CJCoding With Joseph
15free / daySign inCreate account

Abstract classes can be stacked. Document leaves pages() abstract. PrintedDocument extends it, stays abstract, adds a second abstract method costPerPage() and a finished printCost(int copies) that uses both. Flyer is the first concrete class in the chain, so it must give a body to the abstract methods of both levels. Complete Flyer.

Requirements: 1. pages() returns 1. 2. costPerPage() returns PAPER_COST plus the inkCost of this flyer. 3. Leave printCost alone. It is inherited from PrintedDocument.

Do not change Document or PrintedDocument.

Do NOT write a main method.

Expected output

1
0.5
50.0

= newline. The output ends with a newline, so print one after the last line.

Hints2 available
Topics
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.