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
// This expression calculates the remainder or modulo when movieLength (in seconds) is divided by 60. This gives the number of seconds remaining after converting the total seconds into full minutes.
20
23
21
24
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
25
+
// It means the total number of full minutes in the movie length. It subtracts the remaining seconds from the total movie length and then divides that value by 60 to convert it from seconds to minutes.
22
26
23
27
// e) What do you think the variable result represents? Can you think of a better name for this variable?
28
+
// It represents the formatted string of the movie length in hours, minutes and seconds. A better name could be formattedMovieTime or durationMovieFormatted.
24
29
25
30
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
31
+
//Code works correctly, but there are few edge cases to consider:
32
+
// 1. If movieLength is negative, the output won't make sense in the context of time duration.
33
+
// 2. If movieLength is a very large number the output'll still be correct, but not readable - "1.7968563299644136e+35:4:52"
34
+
// 3. If movieLength is zero, the output will be "0:0:0", which is valid but may not be the desired format for representing zero duration.
35
+
// 4. If movieLength is not an integer like floating-point number, the calculations may yield unexpected results - "2:21:8.299999999999272" since time is typically represented in whole seconds.
36
+
// 5. When hours, minutes or seconds are single digits (1:5:3) the output may not be in the desired format with 2digits - "01:05:03".
0 commit comments