Programming Fundamentals Using C++

Assignment 2 · Tuition Estimator — Decisions & Validation

Modules 3–4 (L05–L08) · 40 marks · due end of Week 5 Outcomes: CLO-2, CLO-3 (PF-3.x, PF-4.x)

The bursary quotes a tuition estimate from credit hours and residence status. Your program reproduces their published table — exactly.

Fee table (authoritative)

ResidencyBasePer credit hourCap rule
in1200150total capped at 4500
out2500320total capped at 8000

total = min(base + credits·rate, cap). Scholarships: input scholarship amount (0 or more) is subtracted after the cap; the result never goes below 0.

Requirements

  1. Read: residency word (in/out), credits (int), scholarship (double).
  2. Validate: residency must be exactly in or out (else bad residency, exit 1); credits 1–24 (else bad credits, exit 1); scholarship ≥ 0 (else bad scholarship, exit 1). Check in that order, one message per run.
  3. Print estimate: <total> with 2 decimals.

Sample runs

InputOutput
in 12 0estimate: 3000.00
out 20 500estimate: 7500.00 (2500 + 20·320 = 8900 → cap 8000 → −500)
in 30 0bad credits
xx 10 0bad residency

Constraints

Deliverables

tuition.cpp (course contract, zero warnings) · test_table.md covering both residencies, cap hit, scholarship floor at 0, every validation message, boundary credits 1/24/25 · postmortem.md (10 marks).

Notes

Programming Fundamentals Using C++ · C++17 · 16 weeksBack to top ↑