Tiered conditional logic in if/else if chains.
When the answer depends on which range or tier an input falls into, an ordered ladder is the cleanest tool.
Tiered conditional logic handles problems where the output category depends on a single value's tier — letter grades, shipping costs, tax brackets, age groups. Each tier is a range; the ladder picks exactly one.
Order is critical: the ladder must start with the most restrictive (highest) condition and work down. Any other order produces incorrect tiering.
On the AP exam, tiered logic is a core FRQ pattern and shows up in MCQs about boundary values.
Most restrictive condition first.
First true branch wins; everything else is skipped.
Shipping cost example
public double shippingCost(double weight) {
if (weight > 50) return 100.00;
else if (weight > 20) return 60.00;
else if (weight > 5) return 20.00;
else return 5.00;
}
Order: most expensive (heaviest) first. A 25-pound package matches > 20 first; it never gets to > 5.
Why ordering matters
If we tested weight > 5 first, every package over 5 pounds would cost $20 — even a 100-pound one. The ladder must descend.
Boundary handling
>excludes the boundary.>=includes the boundary.- Pick based on the prompt's wording.
Final else
The ladder ends with an unconditional else covering everything not matched above. Without it, the method may not return on all paths.
Tiered logic vocabulary.
Used in classification FRQs.
- Tier — a discrete range or category.
- Ladder — chained if/else if/else conditions.
- Most restrictive first — order requirement.
- Catch-all — final else branch.
- Mutually exclusive — each input matches exactly one tier.
- Short-circuit — Java stops evaluating once a branch matches.
How tiered logic is tested.
Order and final else dominate.
- Order high to low. Most specific tier first.
- Final else mandatory. Method must always return.
- Boundary inclusion. Match the prompt exactly.
- else if, not independent ifs. Otherwise multiple tiers fire.
Trace tiered shipping.
Different inputs, different tiers.
Using shippingCost above:
- weight = 75: matches > 50 → 100.00.
- weight = 30: fails > 50; matches > 20 → 60.00.
- weight = 10: fails > 50, > 20; matches > 5 → 20.00.
- weight = 3: falls through to else → 5.00.
- weight = 50 (boundary): fails > 50; matches > 20 → 60.00 (50 is NOT greater than 50).
Tiered-logic pitfalls.
Order is the most common mistake.
- Order low to high. Wrong tier fires first.
- Missing final else. Method may not return.
- Independent ifs. Multiple branches fire and final result is the last assigned.
- Wrong boundary operator. Boundary values land in the wrong tier.
Tiered logic checklist.
Three rules.
Tiered Logic Reference
AP Quick Reference| Rule | Why | AP Tip |
|---|---|---|
| Order high to low | First match wins | Most restrictive first. |
| Use else if | Prevents multiple matches | Single-branch semantics. |
| Final else | Always returns | Catch-all default. |
| Boundary operator | Tie placement | Per spec. |
How to master tiered logic.
Sketch the tiers; verify order; trace boundaries.
- MCQ Practice — for each ladder, trace the boundary values.
- Java Lab — implement shippingCost, taxBracket, ageGroup. Always end with else.
- FRQ Practice — order high-to-low; finish with a default; trace boundary inputs.
Practice — attempt these now.
AP-style assessments aligned to this lesson. Time them.
AP CSA Unit 09 Topic 08 Tiered Conditional Logic FRQ Practice
AP-style topic practice assessment