Skip to content

Commit 3f2f851

Browse files
corrected coursework sprint 1
1 parent 2839452 commit 3f2f851

3 files changed

Lines changed: 12 additions & 10 deletions

File tree

Sprint-1/3-mandatory-interpret/1-percentage-change.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@ console.log(`The percentage change is ${percentageChange}`);
1212
// Read the code and then answer the questions below
1313

1414
// a) How many function calls are there in this file? Write down all the lines where a function call is made
15-
//The function call are made twice
16-
//line 4, 5,
15+
//The function call are five
16+
//line 4, 5, 10
1717

1818

1919
// b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem?
20-
20+
// Line 5, it was missing a comma between the characters that are to be replaced so to fix the problem, include a comma
2121

2222
// c) Identify all the lines that are variable reassignment statements
2323
//Lines 7 & 8
2424

2525
// d) Identify all the lines that are variable declarations
2626
//Lines 1 & 2
2727
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
28+
//This expression replaces every instance of "," with "".

Sprint-1/3-mandatory-interpret/2-time-format.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ console.log(result);
1414
// a) How many variable declarations are there in this program?
1515
//6
1616
// b) How many function calls are there?
17-
//4
17+
//1
1818
// c) Using documentation, explain what the expression movieLength % 60 represents it represents the remainder when movielength is divided by 60
1919
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
2020

2121
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
2222
//The expression assigned to totalMinutes means that the remaining seconds are subtracted from the movieLength and then divided by 60 to get the total number of minutes in the movie length.
2323

2424
// e) What do you think the variable result represents? Can you think of a better name for this variable?
25-
//The variable result represents the total time of the movie, in hours minutes and seconds.
25+
//The variable result represents the total time of the movie, in hours minutes and seconds. Abetter name for this variable could be totaltime
2626
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
27-
27+
//Yes it would work, we have accommodated for all length

Sprint-2/4-mandatory-interpret/time-format.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,18 @@ function formatTimeDisplay(seconds) {
2222

2323
// a) When formatTimeDisplay is called how many times will pad be called?
2424
// =============> write your answer here
25-
25+
//3
2626
// Call formatTimeDisplay with an input of 61, now answer the following:
2727

2828
// b) What is the value assigned to num when pad is called for the first time?
2929
// =============> write your answer here
30-
30+
//0
3131
// c) What is the return value of pad is called for the first time?
3232
// =============> write your answer here
33-
33+
//"00"
3434
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
3535
// =============> write your answer here
36-
36+
// 1, pad is called last to calculate the total hours
3737
// e) What is the return value of pad when it is called for the last time in this program? Explain your answer
3838
// =============> write your answer here
39+
// "01", the return value here represents the remaining value of numstring

0 commit comments

Comments
 (0)