Skip to main content

AP CSA FRQ Guide

2005 FRQ 2: Advance and StudentAdvance

Implement advance-purchase theater tickets with a ten-day pricing boundary, then implement student tickets that inherit that pricing, charge half as much, and display the student-ID requirement.

Legacy Ticket Class Hierarchy22 minute targetabstract classesinheritanceconstructorsmethod overridinglegacy

Skills Tested

What this FRQ is really practicing

abstract classesinheritanceconstructorsmethod overridinglegacy

Review these topics before attempting the problem.

Starter Approach

How to begin with your own plan

  1. 1Part A: implement Advance as a Ticket subclass with a constructor accepting days in advance and a getPrice method.
  2. 2Charge 30 dollars when purchased at least ten days ahead and 40 dollars when purchased fewer than ten days ahead.
  3. 3Part B: implement StudentAdvance as an Advance subclass whose constructor passes the advance-purchase information to its superclass.
  4. 4Compute the student price as half the inherited advance price and extend the inherited description with the student-ID requirement.

Attempt the problem before opening the solution.

Common Mistakes

Mistakes to watch for while writing

Charging the higher price for a ticket purchased exactly ten days ahead.
Hard-coding student prices instead of using the superclass pricing method.
Replacing inherited ticket details or trying to access the private serial number directly.

Self Check

Review questions before you submit

Uses the ten-day advance-purchase boundary.

Exactly ten days ahead receives the lower advance price.

Initializes StudentAdvance through its superclass constructor.

Pass the supplied days-in-advance value to Advance.

Calculates half of the inherited advance price.

The student price must still work if Advance pricing changes.

Preserves ticket details and adds the student-ID requirement.

Extend super.toString() so the serial number and computed price remain present.

Practice Links

Where to go next