You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//movieLength % 60 returns the remaining seconds after converting total seconds into full minutes.
22
+
21
23
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
22
24
25
+
//It subtracts the leftover seconds (remainingSeconds) from the total movie length (movieLength) to get the number of seconds that make up complete minutes, and then divides by 60 to convert those seconds into total minutes.
26
+
23
27
// e) What do you think the variable result represents? Can you think of a better name for this variable?
24
28
29
+
//result is too general — it does not tell what the value means.
30
+
//The variable result represents the movie running time in hours, minutes, and seconds (HH:MM:SS)
31
+
//A better variable name would be movieRunTime or formattedRunTime.
32
+
25
33
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
34
+
35
+
//Yes, this code works for all positive integer values of movieLength.
36
+
//It converts seconds into hours, minutes, and seconds using division and remainder.
37
+
//For example, when movieLength = 5550, the result is 1:32:30.
0 commit comments