Add to the Parent's Price With super.getPrice()
easyQuestion 509VipTicket extends Ticket and overrides getPrice(). The base price is private in Ticket, so the override cannot read the field. It asks the parent's version of the method for the value with super.getPrice() and adds to it.
Requirements:
1. getPrice() returns the parent's price plus the constant LOUNGE_FEE.
2. Call the parent's version with super.getPrice(). Calling plain getPrice() inside the override would call the override again and never stop.
The Ticket class is provided. Do not change it.
Do NOT write a main method.
Expected output
80.0 130.0
= newline. The output ends with a newline, so print one after the last line.
Hints3 available
Sign in to use hintsTopics
InheritanceClasses
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.