Practice

Patient Reading Warnings

·Q11·[12 marks]
HARD2D Arrays0478/2B12 marks

A ward stores each patient's latest temperature and pulse in a 2D array Readings[1:3, 1:2]: column 1 is temperature (°C, real) and column 2 is pulse (beats per minute). A parallel 1D array Patient[1:3] holds the names.

Normal ranges (inclusive): temperature 36.1 to 37.2, pulse 60 to 100.

For each patient output:

  • Normal if both readings are in range
  • Warning: temperature or Warning: pulse if exactly one is out of range
  • Severe warning: pulse and temperature if both are out of range

Inspired by the Cambridge IGCSE (0478) specimen Paper 2B hospital-readings task, reduced to 3 patients.

Input: 3 names, then 3 pairs of temperature and pulse. Output: Three lines <name>: <status>.

Example:

Input:  Amal
        Ben
        Chen
        36.5
        72
        36.8
        110
        38.0
        55
Output: Amal: Normal
        Ben: Warning: pulse
        Chen: Severe warning: pulse and temperature
Premium is coming soon. All grading features are currently unlocked.

Sample Test Cases

Test 1: One of each outcome
Inputs: Amal, Ben, Chen, 36.5, 72, 36.8, 110, 38.0, 55
Expected: Amal: Normal Ben: Warning: pulse Chen: Severe warning: pulse and temperature
Test 2: Inclusive boundaries
Inputs: Dee, Eli, Fay, 36.1, 60, 37.2, 100, 36.0, 80
Expected: Dee: Normal Eli: Normal Fay: Warning: temperature