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 7fcde6c
Browse filesBrowse the repository at this point in the historyBrowse files
// For the piece of code above, read the code and then answer the following questions
13
13
14
14
// a) How many variable declarations are there in this program?
15
+
// 6
15
16
16
17
// b) How many function calls are there?
18
+
// none
17
19
18
20
// c) Using documentation, explain what the expression movieLength % 60 represents
21
+
// movieLength represents the total seconds and with the remainder operator it represents the amount of seconds left over after the number is divided by 60
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
25
+
// It means to create the amount of total minutes by subtracting the remainingSeconds from movieLength and dividing the resulting number of seconds by 60 to get the result in 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 movie length in hours, minutes and seconds. A better name would be totalMovielength
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
+
// I changed the movieLength to 18784 and the code still works as it gave me back 5:13:4 after running it. The variables would need to be altered or changed for it to stop working.
0 commit comments