SeniorPass Subclass
easyQuestion 120Consider the TransitPass and StudentPass classes shown below. Define a subclass called SeniorPass that extends TransitPass.
Requirements:
1. Create a constructor that uses super() to set the base fare.
2. Seniors ride free, so the senior rate should be 0.0.
3. Override calcFare() to use the senior rate.
4. Override toString() to return: "Senior Pass: <rate>".
Do NOT write a main method. A hidden Main will test your class.
TransitPass and StudentPass are provided in the tests.
Expected output
3.0 0.0 Senior Pass: 0.0
= newline. The output ends with a newline, so print one after the last line.
Hints3 available
Sign in to use hintsTopics
Classes
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.