01
Overview

A class that prices by tier.

Combine class state with tiered conditional logic to compute prices that depend on category, quantity, or membership level.

Pricing problems are a classic AP FRQ. The class holds state (item type, quantity, member status); the pricing method uses an if/else if ladder to compute the right cost.

This pattern combines complete-class design with tiered conditional logic and sometimes boolean surcharges or discounts.

On the AP exam, pricing FRQs appear in shop/membership/ticket scenarios.

02
Core Concept

State drives the tier; tier drives the price.

Standard pricing pattern.

Membership class

public class Membership {
    private String level;        // "bronze", "silver", "gold"
    private boolean isStudent;

    public Membership(String level, boolean isStudent) {
        this.level = level;
        this.isStudent = isStudent;
    }

    public double monthlyCost() {
        double base;
        if (level.equals("gold")) base = 50;
        else if (level.equals("silver")) base = 30;
        else base = 15;            // bronze

        double discount = isStudent ? 5 : 0;
        return base - discount;
    }

    public String getLevel() { return level; }
    public void upgrade(String newLevel) { this.level = newLevel; }
}

The base cost comes from a three-tier ladder. The student discount is a simple boolean adjustment. Total returned in one step.

Pattern recap

  • Determine base via tiered if/else.
  • Apply surcharge or discount.
  • Combine and return.
03
Key Vocabulary

Pricing vocabulary.

Used in shop/ticket FRQs.

Vocabulary
  • Tier — discrete price level.
  • Base cost — price from the tier.
  • Discount — subtracted from base.
  • Surcharge — added to base.
  • Total — base ± adjustments.
04
AP Exam Focus

How pricing classes are tested.

Ladder order and discount placement dominate.

Exam Focus
  • Ladder ordered correctly. Highest tier first, or per spec.
  • Discount/surcharge separate. Cleaner than baking into each branch.
  • Use .equals() for level strings.
  • Default branch. Catches unrecognized level.
05
Worked Example

Compute prices for various members.

Different tiers, different discounts.

Worked Example AP-style reasoning

Using the Membership class above:

  • new Membership("gold", false).monthlyCost() → 50 - 0 = 50.
  • new Membership("gold", true).monthlyCost() → 50 - 5 = 45.
  • new Membership("silver", true).monthlyCost() → 30 - 5 = 25.
  • new Membership("bronze", false).monthlyCost() → 15.
  • new Membership("bronze", true).monthlyCost() → 10.
06
Common Mistakes

Pricing-class pitfalls.

String comparison and missing discount.

Watch Out
  • == on level strings. Use .equals().
  • Discount duplicated in each tier. Compute once and apply.
  • Returning base instead of total. Forgetting to apply the discount.
  • Missing final else. Some inputs fall through with no value.
07
Reference Table

Pricing class structure.

Tier + adjustment + return.

Pricing Class Reference

AP Quick Reference
StepSourceOperation
Determine baseTier fieldif/else if
Apply adjustmentBoolean fieldAdd or subtract
Return totalLocal sumSingle return
08
Practice Tip

How to master pricing classes.

Separate base and adjustment.

Practice Strategy
  • MCQ Practice — trace all (tier, discount) combinations to verify the math.
  • Java Lab — write Membership, TicketPrice, ShippingCost classes.
  • FRQ Practice — compute base then adjustments; sum at the end.
09
Section · 09

Practice — attempt these now.

AP-style assessments aligned to this lesson. Time them.

FRQ Practice 30 min 20 marks Pending

AP CSA Unit 13 Topic 05 Complete Class with Conditional Pricing FRQ Practice

AP-style topic practice assessment

Start