W WolfCode · CSC 141

Homework: Tax Bracket Calculator

作业: 阶梯税率计算器

≈ 35 min · python-conditionals · Open in WolfCode

Combines every Chapter 2 skill in a problem you'd actually solve at a job. Marginal tax brackets — same shape as shipping tiers, volume discounts, and any tiered pricing.

The brackets (simplified 2024 single-filer)

  • $0 – $11,600 → 10%
  • $11,600 – $47,150 → 12%
  • $47,150 – $100,525 → 22%
  • $100,525 – $191,950 → 24%
  • above $191,950 → 32%

Worked trace — income = $25,000

  • First $11,600 at 10% → $1,160.00
  • Remaining $13,400 at 12% → $1,608.00
  • Total: $2,768.00

Pattern: start from the prior buckets, then add the partial

Sketch of the pattern (not the full solution)

Acceptance criteria

  • All 8 tests pass (target ≥ 7/8 per tests_pass_required)
  • income_tax(...) returns a float
  • All values rounded to 2 decimal places (round(total, 2))
  • No loops, no extra imports, no extra functions — Ch. 2 toolset only

If you find yourself wanting the full answer…

Re-do the BMI Category exercise. This homework is structurally the same problem with extra brackets and arithmetic. The "wanting the answer" feeling is a signal to slow down and re-engage with the simpler version.