Practice
River BOD Pollution Report
2026/May/June·Variant 3·Q10·[15 marks]
HARD2D Arrays
Two rivers are sampled for 4 days. Store names in RiverNames and readings in RiverStats[1:4, 1:2] (rows are days, columns are rivers).
A day is moderately polluted when BOD is from 2 to 8 inclusive, and highly polluted when BOD is greater than 8. For each river output the average BOD rounded to 2 d.p., the moderate-day count, and the high-day count. Then output the river with the most highly polluted days (first river wins a tie).
Input: Two names, then 8 readings day-by-day (river 1 then river 2, four times). Output: Two river summaries, then the most-polluted name.
Example:
Input: Nile
Amazon
1
3
2
3
9
3
10
3
Output: Nile average 5.5 moderate 1 high 2
Amazon average 3 moderate 4 high 0
Most polluted: Nile
Sample Test Cases
Test 1: Nile has two high days
Inputs: Nile, Amazon, 1, 3, 2, 3, 9, 3, 10, 3
Expected: Nile average 5.5 moderate 1 high 2
Amazon average 3 moderate 4 high 0
Most polluted: Nile
Test 2: Readings of 0 are neither moderate nor high
Inputs: A, B, 0, 9, 0, 9, 0, 9, 0, 9
Expected: A average 0 moderate 0 high 0
B average 9 moderate 0 high 4
Most polluted: B