Weekly Screen Time Grid
Students log daily screen time (minutes) in a 2D array. StudentName[1:3] holds the names. ScreenTime[1:3, 1:3] holds three days of minutes for those same students (row = student, column = day).
Read the three names, then the 9 daily totals. For each student output their name, weekly total minutes, and how many days were more than 300 minutes. Then output the name of the student with the lowest weekly total (the earlier student wins a tie).
Inspired by Cambridge IGCSE Computer Science (0478) Feb/Mar 2024 Paper 22 Question 11 — shortened to 3 students × 3 days so it can be auto-graded.
Input: 3 names, then 9 integers (row by row).
Output: Three <name> <total> <daysOver300> lines, then Lowest: <name>.
Example:
Input: Amal
Ben
Chen
320
100
80
50
60
70
310
305
10
Output: Amal 500 1
Ben 180 0
Chen 625 2
Lowest: Ben
Sample Test Cases
Premium Question
This question needs a paid plan — upgrade, or join a class from a teacher who has one. You can read the description and sample tests, but grading is locked.
Sign in to get started