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 24f5004
Browse filesBrowse the repository at this point in the historyBrowse files
Modify movieLength and enhance comments for clarity
Updated movieLength to a negative value and added comments for clarity on variable declarations and function calls. Suggested improvements for handling negative movie lengths.
// "operator returns the remainder left over when one operand is divided by a second operand. It always takes the sign of the dividend."
20
+
// it represent the number of seconds left over after taking all the complete minutes
21
+
21
22
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
22
-
// it means the number of minutes in a film is calculated by calculating the number of seconds in the film
23
+
//here in the expression we have the movieLength taken from it the number of remainingSeconds, so the operator / 60 represents the conversion of the remaining seconds into minuttes, so we left with complete minutes only
23
24
// e) What do you think the variable result represents? Can you think of a better name for this variable?
24
25
//the variable result represesnt the length of the film in hours,minutes,and seconds. A better name would be movie time.
25
26
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
26
-
// However, it doesn't work when the leading number of a decimal is zero like this 08784 because it interpreted as octal literal and 8 can't work in octal numeration
27
-
//"The octal number system is a base-8 math and computing system that uses only eight digits: 0, 1, 2, 3, 4, 5, 6, and 7"
27
+
//8784
28
+
//if experimented values into the movieLength variable what will happen? Lets start with the following values:
29
+
//-10 , 0, 10 , 10000000, -1000000
30
+
//0:0:-10, 0:0:0,0:0:10,2777:46:40, -277:-46:-40
31
+
//ok I notice the result get strange with big negative numbers, so I think the code needs to be modified to restrict using negative values
0 commit comments