Repair an inclusive parking threshold

Scenario. A parking area is free for stays of 30 minutes or less. Longer stays cost 5 euros.

Inputs. Minutes Parked, a whole number from 0 through 480.

Rules and notation. Output a fee of 0 euros for 30 minutes or less and 5 euros for more than 30 minutes.

Assumptions. The input has already been checked against the stated range. No other rates or fees apply.

Deliverable. Complete the checking sequence in three phases:

  1. Plan. Record a purpose and expected fee for 29, 30, and 31 minutes before inspecting Listing 1.
  2. Trace and diagnose. Record the observed fee and verdict for each case. Identify the first mismatch and the condition that causes it.
  3. Repair and retest. Change only the faulty condition and repeat all three planned tests.

Success criteria. The plan contains values immediately below, at, and above the threshold. The exact-threshold test exposes the defect, the repair follows the “30 minutes or less” rule, and the neighboring cases retain their required results.

Listing 1: Proposed parking-fee algorithm that uses the strict condition Minutes Parked < 30 to choose between a zero-euro and 5-euro fee.
Input: Minutes Parked
Output: Fee
Start
   If Minutes Parked < 30
      Set Fee to 0
   Else
      Set Fee to 5
   End If

   Output Fee
End

Translate the words “30 minutes or less” into one comparison.