CJCoding With Joseph
15free / daySign inCreate account

SeniorPass Subclass

Consider 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 — print one after the last line.

Hints3 available
Topics:
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.