2005 AP CSA FRQ 2: Ticket - Complete Solution

2005 AP CSA FRQ 2: Ticket

Topic: Inheritance & Polymorphism

Skills Tested: Subclass creation, constructor chaining, method overriding, super keyword

Curriculum Alignment: Unit 3 (Class Creation) (2025-2026 AP CSA)

Points: 9 | Time Estimate: ~22 minutes

Part (a)

Write the complete Advance class that extends Ticket. Price is $30 if purchased 10+ days in advance, $40 otherwise.

Try It First! Attempt to solve this part before viewing the solution. Use the concepts: Subclass creation.

Solution

public class Advance extends Ticket
{
    private double price;
    
    public Advance(int days)
    {
        super();
        
        if (days >= 10)
            price = 30;
        else
            price = 40;
    }
    
    public double getPrice()
    {
        return price;
    }
}

Part (b)

Write the complete StudentAdvance class that extends Advance. Students pay half price and must show ID.

Solution

public class StudentAdvance extends Advance
{
    public StudentAdvance(int days)
    {
        super(days);
    }
    
    public double getPrice()
    {
        return super.getPrice() / 2;
    }
    
    public String toString()
    {
        return super.toString() + "\n(student ID required)";
    }
}

Key Concepts

Multi-level inheritance: StudentAdvance extends Advance extends Ticket
Use super(days) to pass parameters to parent constructor
Override getPrice() to modify pricing behavior
Override toString() to add additional information

Common Mistakes to Avoid

Forgetting to call super() or super(days) in constructors
Not using super.getPrice() when calculating student price
Hardcoding price instead of using parent's calculation
Missing the instance variable declaration

Scoring Guidelines

Total Points: 9

Points are awarded for:

  • Correct loop structure and bounds
  • Proper method calls and return statements
  • Correct conditional logic
  • Handling edge cases appropriately

Partial credit is available for demonstrating understanding even with minor syntax errors.

Official College Board Resources

About the Author: Tanner Crow is a certified AP Computer Science teacher with 11+ years of experience helping students succeed on the AP CSA exam.

Last updated: January 2026

Get in Touch

Whether you're a student, parent, or teacher — I'd love to hear from you.

Just want free AP CS resources?

Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.

Typically responds within 24 hours

Message Sent!

Thanks for reaching out. I'll get back to you within 24 hours.

🏫 Welcome, fellow educator!

I offer curriculum resources, practice materials, and study guides designed for AP CS teachers. Let me know what you're looking for — whether it's classroom materials, a guest speaker, or Teachers Pay Teachers resources.

Email

[email protected]

📚

Courses

AP CSA, CSP, & Cybersecurity

Response Time

Within 24 hours

Prefer email? Reach me directly at [email protected]