CJCoding With Joseph
15per day

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
Topics:
Classes
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.