01
Overview

Tiered cost plus an optional surcharge.

A base cost determined by a numeric tier, plus an additional charge if a boolean flag is true.

Many real-world pricing problems combine two patterns: a tiered base cost based on a numeric input (weight, distance, age) and a boolean surcharge added if a flag is set (fragile, express, weekend).

The clean structure: compute the base via an if/else if ladder; then add the surcharge with a single if; return the total.

On the AP exam, this combined pattern appears in pricing-style FRQs and stat-based MCQs.

02
Core Concept

Tier first; surcharge second; sum.

Two stages, one return.

The template

public double calculateCost(double weight, boolean fragile) {
    double base;
    if (weight > 50) base = 100;
    else if (weight > 20) base = 60;
    else if (weight > 5) base = 20;
    else base = 5;

    double surcharge = fragile ? 25 : 0;
    return base + surcharge;
}

Ternary for the surcharge

fragile ? 25 : 0 is shorthand for an if/else that picks 25 or 0. Equivalent to:

double surcharge;
if (fragile) surcharge = 25;
else surcharge = 0;

Order independence

The surcharge can come before or after the tiered calculation — they're independent. Compute each cleanly, then combine.

Why keep them separate?

Mixing the surcharge into each tier branch means writing + 25 in four places (one per tier). Computing it once and adding once is cleaner and avoids duplication bugs.

03
Key Vocabulary

Tier + surcharge vocabulary.

Used in pricing FRQs.

Vocabulary
  • Base cost — primary charge from the tier.
  • Surcharge — additional charge for a feature.
  • Tier — range bucket determining base cost.
  • Boolean flag — true/false input determining surcharge.
  • Ternarycond ? a : b expression.
  • Total — base + surcharge.
04
AP Exam Focus

How tiered + boolean problems are tested.

Combining the two correctly is the trap.

Exam Focus
  • Tier ladder ordered high to low. Standard rule.
  • Surcharge independent. Add after base is computed.
  • Boolean simply tested. if (flag), not if (flag == true).
  • Return type matches both. Usually double for money.

MCQ patterns: trace the total for several (weight, flag) combinations; identify which inputs produce the same total.

05
Worked Example

Calculate shipping with surcharge.

Combine tier and flag across multiple inputs.

Worked Example AP-style reasoning

Setup. Using calculateCost above. Compute cost for several inputs.

  • weight = 25, fragile = false: base = 60, surcharge = 0 → 60.
  • weight = 25, fragile = true: base = 60, surcharge = 25 → 85.
  • weight = 3, fragile = true: base = 5, surcharge = 25 → 30.
  • weight = 75, fragile = false: base = 100, surcharge = 0 → 100.
  • weight = 75, fragile = true: base = 100, surcharge = 25 → 125.

Boundary check. weight = 20 (boundary): 20 > 50 false; 20 > 20 false; 20 > 5 true → base = 20. Using strict > matters — 20 falls into the third tier, not the second.

Why this matters. The tier and surcharge contribute independently to the total. Trace each separately, then sum.

06
Common Mistakes

Tier + surcharge pitfalls.

Most mix the two stages or test the boolean awkwardly.

Watch Out
  • Putting the surcharge inside the tier ladder. Each branch ends up adding the surcharge separately — easy to miss one branch.
  • Testing flag == true. Redundant — just write if (flag).
  • Forgetting to add the surcharge to base. Returns only one of the two contributions.
  • Wrong tier order. Standard ladder mistake — high to low.
  • Returning inside the ladder before adding the surcharge. The early return skips the rest of the method.
  • Mixing up boundary operators. > vs >= shifts boundary values into the wrong tier.
07
Reference Table

Tier + surcharge structure.

Two stages; one total.

Tiered + Boolean Reference

AP Quick Reference
StageStructureOutput
Tier ladderif/else if/elsebase cost
Boolean checkif (flag) or ternarysurcharge
Combinebase + surchargetotal
ReturnSingle valuedouble or int
08
Practice Tip

How to master tiered + boolean problems.

Separate the stages; compute each cleanly; combine at the end.

Practice Strategy

Use the three practice tools below this lesson in order:

  • MCQ Practice — for each input combination, compute base and surcharge independently, then sum.
  • Java Lab — write calculateCost variants with different tiers and flags. Test all four combinations of tier × flag boundary values.
  • FRQ Practice — outline base and surcharge as separate variables; combine at the return.

If you can split any pricing problem into "tier first, surcharge second, sum at the end", this hybrid pattern becomes a confident, high-credit FRQ response.

09
Section · 09

Practice — attempt these now.

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

FRQ Practice 30 min 18 marks Pending

AP CSA Unit 09 Topic 10 Tiered Cost with a Boolean Surcharge FRQ Practice

AP-style topic practice assessment

Start