Sheffield | 26-Jan-ITP | Karim Mhamdi | Sprint 1 | Coursework/sprint-1#1092
Sheffield | 26-Jan-ITP | Karim Mhamdi | Sprint 1 | Coursework/sprint-1#1092KKtech06 wants to merge 1 commit intoCodeYourFuture:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| // Line 3 is updating the value of the count variable. | ||
| // The = operator is an assignment operator, which assigns the value on the right (count + 1) to the variable on the left (count). No newline at end of file |
There was a problem hiding this comment.
Operation like count = count + 1 is very common in programming, and there is a programming term describing such operation.
Can you find out what one-word programming term describes the operation on line 3?
There was a problem hiding this comment.
Thank you for the feedback I well work on it and and I well put a better description
There was a problem hiding this comment.
Your description is good. I just want everyone to know the relevant programming term.
| const dir = ; | ||
| const ext = ; | ||
| const dir = filePath.slice(0, lastSlashIndex); | ||
| const ext = filePath.slice(filePath.lastIndexOf(".")) ; |
There was a problem hiding this comment.
Code is correct.
On line 21, there are some trailing space characters.
Trailing spaces do not affect program execution, but they can influence how Git detects changes in a file.
If you enabled "Format on save" in VSCode, and you have installed "prettier" extension, VSCode can automatically indent the code and remove all trailing space characters.
| //Step 1 Generate a random decimal between 0 and 1 | ||
| //step 2 multiplys the random decimal by 100 - 1 = 99 + 1 = 100 | ||
| //step 3 math.floor makes it a whole number between 0 and 99 | ||
| //step 4 adds 1 to make it a whole number between 1 and 100 No newline at end of file |
There was a problem hiding this comment.
Phrases like "a number between X and Y" are not precise enough in a program specification, because they do not clearly state whether the endpoints X and Y are included.
We can use the concise and precise interval notation to describe a range of values.
[,]=> inclusion(,)=> exclusion
For example, [1, 10) means, all numbers between 1 and 10, including 1 but excluding 10.
| console.log(`I was born in ${cityOfBirth}`); | ||
| console.log("I was born in Bolton"); | ||
| const cityOfBirth = "Bolton"; |
There was a problem hiding this comment.
The reason you gave does not quite explain why the original code does not work.
What was the error message reported by the JS runtime?
| // line 10 has a function call | ||
|
|
||
| // 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? | ||
| // I have spotted the error in line 5 becouse there was a missing comma inside the brackets. |
There was a problem hiding this comment.
Can you revise the description to indicate where inside the brackets (parentheses) the comma is missing? (e.g., the comma is missing between the ___________ )
| // line 8 | ||
|
|
||
| // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? | ||
| // The purpose of this expression is to remove the commas from the string value using the replaceAll(). |
There was a problem hiding this comment.
What about the Number( ... ) part?
| // then divides the result by 60 to calculate the total full minutes. | ||
|
|
||
| // e) What do you think the variable result represents? Can you think of a better name for this variable? | ||
| // Result is a formatted time string in hours minutes and seconds. |
There was a problem hiding this comment.
There are two questions in part (e). Can you also answer the second question?
| // 4. Takes everything except the last 2 digits as pounds. | ||
| // 5. Prints the result in this format: £3.99 |
There was a problem hiding this comment.
(4) and (5) does not quite describe the code on lines 14-16.
Also, could we expect this program to work as intended for any valid penceString if we deleted .padEnd(2, "0") from the code?
In other words, do we really need .padEnd(2, "0") in this script?
| What is the return value of `prompt`? | ||
| What effect does calling the `prompt` function have? The prompt function displays a popup box asking you to enter a text and pausing the page until you click ok or cancel. | ||
|
|
||
| What is the return value of `prompt`? Prompt returns the text entered by the user as a string if the user clicks cancel. |
There was a problem hiding this comment.
The answer does not look correct. Can you revise it?
Learners, PR Template
Self checklist
Changelist
I have completed all the tasks for the Sprint-1 and i have created a branch Coursework/Sprint1
Questions
N/A