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
// It is counting the remaining seconds after all the full minutes have been taken out of the movie length.
24
+
// For example if the movie length is 125 seconds, then 125 % 60 would give us 5 seconds remaining after taking out the full minutes (2 minutes in this case).
20
25
21
26
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
27
+
// The expression (movieLength - remainingSeconds) / 60 calculates the total number of minutes in the movie length.
28
+
// It subtracts the remaining seconds from the total seconds and then divides by 60 to get the total minutes.
22
29
23
30
// e) What do you think the variable result represents? Can you think of a better name for this variable?
31
+
// result gives the length of the movie in hours, minutes and seonds
32
+
// a better name may be movieLengthFormatted or something similar
24
33
25
34
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
35
+
// Yes, this code will work for all values of movieLength
36
+
//%60 gives the remainder and the remainder is always taken away before dividing for minutes and hours
37
+
// so it will always give the correct number of hours, minutes and seconds regardless of the length of
0 commit comments