Programming Fundamentals Using C++

Project 01 · Student Grade Calculator

Modules 1–8 (Weeks 1–8) · no arrays, no files, no structs — functions are the architecture Outcomes: CLO-1…CLO-5 (PF-1…PF-8). Difficulty: ★☆☆☆☆

1. Problem description

A tutoring center computes end-of-term grades from three components: lab 25 %, midterm 35 %, final 40 %. Their volunteer desk does this by hand and makes arithmetic errors. Write a console program that processes students one at a time (an interactive session, not a data file), computes each weighted average, maps it to a letter grade, and ends the session with a summary of everyone processed in this run.

2. Learning objectives

  1. Decompose a small problem into single-purpose functions with contracts.
  2. Use reference parameters where a function must return more than one value.
  3. Apply decision ladders correctly (descending thresholds).
  4. Validate every read at the boundary; distinguish bad data from end-of-run.
  5. Distinguish integer counts (int) from weighted measures (double).

3. Functional requirements

4. Non-functional requirements

5. Suggested data structures

Per student: five locals in main (name + three marks + average). Per session: four accumulators (count, sum of averages, best average, best name). The maximum-tracking pattern (init from first value, L17 discipline) is expected even though arrays are not — accumulate as you go.

6. User interaction design

Student (or DONE): Ayesha
lab midterm final: 88 79 91
Ayesha: 86.05 -> C+
Student (or DONE): Bilal
lab midterm final: 105 80 80
bad mark for lab
Student (or DONE): DONE
students: 1  best: Ayesha 86.05  class avg: 86.05  below 60: 0

Prompts exactly as shown; no other output lines. One space between fields in the summary; averages always 2 decimals.

7. Input validation requirements

8. Testing plan

#ClassInputExpected
T1typicalAyesha 88 79 9186.05 -> C+
T2boundaryall three marks 90 exactly90.00 -> A
T3boundaryall three marks 89.999… (use 89.99)B+ (>= 90 fails)
T4even weightslab 0 midterm 0 final 00.00 -> F, counts below 60
T5invalidlab 105bad mark for lab, not in summary
T6EOF mid-recordname then EOFbad input, exit 1
T7immediate DONEDONEno students
T8best trackingAyesha 86.05 then Bilal 92.50best Bilal 92.50

Pre-compute expected values before running (testing.md discipline); keep observed ≠ expected rows in the table with a one-line diagnosis.

9. Milestones

  1. M1 (½ session): single student, FR1–FR2, no letters — get the weighted math exact.
  2. M2: letter ladder (FR3) with its own function + T1–T3.
  3. M3: session loop + rejection path (FR4, FR6, VR2) + T5–T7.
  4. M4: summary (FR5) + T4, T8 + full rubric self-check.

10. Extension ideas ⚙

11. Assessment rubric (10 points when graded as homework)

PointsLine
0–3FR1–FR3 correct (weights exact, ladder thresholds, 2 dp)
0–2Session loop + rejection path (FR4, FR6, VR1–VR3)
0–2Summary accumulators correct (FR5, T4/T8)
0–2NFR1/NFR2/NFR4: function decomposition with contracts, no globals
0–1Test table with pre-computed expectations

Course-gate: does not compile with the contract → 0 (rubrics cap).

12. Student instructions

Work individually. Read the whole spec before coding; implement milestones in order and compile after each. The deliverable is grade_calc.cpp plus test_table.md (T1–T8 minimum) plus postmortem.md (one real defect: symptom → hypothesis → test → fix). Submit as a zip named p01_<yourid>.zip. Late policy per syllabus. Ask clarifying questions early — "the spec was ambiguous" is only a valid defense if you asked by Week 7.

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