Back to Set 1

Code Challenge: Screen Time

Difficulty  

divider

The Brief

What they asked for
My phone tells me I used it for some huge number of minutes
this week and I have no idea whether that is bad. Turn it
into hours and minutes, and tell me the daily average too.

Write your requirements list before you write any code. What goes in, what gets worked out, what comes out, and every question the brief did not answer.


Notes

  • Hours and minutes out of a single number is a division and a remainder. You have both.
  • Lua's / never truncates, so 1147 / 60 is not 19. Session 5 has the fix.
  • The daily average has the same shape as the first answer. If you find yourself writing it twice, that is a hint about session 21 — but do it twice for now.
  • A remainder of 0 should read sensibly. Check it.

Sample Output

Sample Output
Minutes this week: 1147 [Enter]
That is 19 hours and 7 minutes.
Daily average: 2 hours and 43 minutes.

Test 60, 59, and 1440. One of those three shows up a rounding decision you have not made yet.


Submit

Your requirements list and your program folder, named cc-screen-time.

Commence Challenge