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
{{ message }}
Repository navigation
Commit e556d1d
Browse filesBrowse the repository at this point in the historyBrowse files
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
21
+
movieLength % 60 means finding the remainder after dividing movieLength by 60. movieLength = 8784 so we need to do: 8784 % 60 = 146.4 and the nearest whole integer is 146.
22
+
So there are 146 complete groups of 60. we then multiply; 146 x 60= 8760 --> 8784 - 8760 = 24 so 8784 % 60 = 24 and therefore remainingSeconds becomes 24.
22
23
24
+
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
25
+
const totalMinutes = (movieLength - remainingSeconds) / 60 ---> if we break it down -> movieLength = 8784 remainingSeconds = 24
26
+
we then subtract remainingSeconds from movieLength= 8784 -24 = 8670. we then have to divide it by 60 which gives us 8760 / 60 = 146. we divide because there is 60 seconds in one minute, and right now we are converting seconds into minutes.
23
27
// e) What do you think the variable result represents? Can you think of a better name for this variable?
24
-
28
+
The result variable will show us he complete results from our calculations of = totalHours:remainingMinutes:remainingSeconds.
29
+
result = 2:26:24
25
30
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
31
+
I tested differnet codes: 7965 and I got the result 2:12:45 and i also tried : 2654 and got 0:44:14.
0 commit comments