From e49f9cb4172881a2b5bee769d6b45720d3a1f60b Mon Sep 17 00:00:00 2001 From: Edward Kganyago Date: Tue, 29 Sep 2026 16:55:29 +0200 Subject: [PATCH 01/11] Completed first error --- Sprint-2/1-key-exercises/4-random.js | 11 ++++++++++- Sprint-3/1-key-errors/0.js | 9 +++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 292f83aab..038b330bb 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -1,4 +1,4 @@ -const minimum = 1; +/*const minimum = 1; const maximum = 100; const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; @@ -7,3 +7,12 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; // Try breaking down the expression and using documentation to explain what it means // It will help to think about the order in which expressions are evaluated // Try logging the value of num and running the program several times to build an idea of what the program is doing +<<<<<<< Updated upstream +======= +console.log(num)*/ + +function greet(timeOfDay, name="edward"){ + console.log(`Good ${timeOfDay}, ${name}.`); +} +console.log(`hello${greet("12:00")} how are you?`) +>>>>>>> Stashed changes diff --git a/Sprint-3/1-key-errors/0.js b/Sprint-3/1-key-errors/0.js index 653d6f5a0..9b82d52e0 100644 --- a/Sprint-3/1-key-errors/0.js +++ b/Sprint-3/1-key-errors/0.js @@ -1,13 +1,18 @@ // Predict and explain first... // =============> write your prediction here +//"str" is not a valid variable name // call the function capitalise with a string input // interpret the error message and figure out why an error is occurring function capitalise(str) { - let str = `${str[0].toUpperCase()}${str.slice(1)}`; + let str= `${str[0].toUpperCase()}${str.slice(1)}`; return str; } -// =============> write your explanation here +// =============> write your explanation heres // =============> write your new code here +function capitalise(str) { + let string1= `${str[0].toUpperCase()}${str.slice(1)}`; + return string1; +} \ No newline at end of file From 4f07ca0ae6c5056322505ce25822c4abae441ba1 Mon Sep 17 00:00:00 2001 From: Edward Kganyago Date: Tue, 29 Sep 2026 17:03:09 +0200 Subject: [PATCH 02/11] Completed error 1 --- Sprint-3/1-key-errors/1.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Sprint-3/1-key-errors/1.js b/Sprint-3/1-key-errors/1.js index f2d56151f..049005cd0 100644 --- a/Sprint-3/1-key-errors/1.js +++ b/Sprint-3/1-key-errors/1.js @@ -1,20 +1,29 @@ // Predict and explain first... - +//decimal number was already declaired +//logging wrong thing // Why will an error occur when this program runs? // =============> write your prediction here // Try playing computer with the example to work out what is going on -function convertToPercentage(decimalNumber) { - const decimalNumber = 0.5; +/*function convertToPercentage(decimalNumber) { + let decimalNumber = 0.5; const percentage = `${decimalNumber * 100}%`; return percentage; } -console.log(decimalNumber); +console.log(decimalNumber);*/ // =============> write your explanation here // Finally, correct the code to fix the problem // =============> write your new code here +function convertToPercentage(decimalNumber) { + + const percentage = `${decimalNumber * 100}%`; + + return percentage; +} + +console.log(convertToPercentage); \ No newline at end of file From 6700cbc2588c03d72f04dec637f1d6dd16c0e75f Mon Sep 17 00:00:00 2001 From: Edward Kganyago Date: Tue, 29 Sep 2026 17:05:04 +0200 Subject: [PATCH 03/11] completed error 2 --- Sprint-3/1-key-errors/2.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Sprint-3/1-key-errors/2.js b/Sprint-3/1-key-errors/2.js index aad57f7cf..95c6708e3 100644 --- a/Sprint-3/1-key-errors/2.js +++ b/Sprint-3/1-key-errors/2.js @@ -3,11 +3,11 @@ // this function should square any number but instead we're going to get an error -// =============> write your prediction of the error here +// =============> num is not defied -function square(3) { +/*function square(3) { return num * num; -} +}*/ // =============> write the error message here @@ -16,5 +16,8 @@ function square(3) { // Finally, correct the code to fix the problem // =============> write your new code here +function square(num) { + return num * num; +} From 00e61a2d4684fb04e9eb3a745d153d00fb05d6eb Mon Sep 17 00:00:00 2001 From: Edward Kganyago Date: Tue, 29 Sep 2026 17:10:35 +0200 Subject: [PATCH 04/11] fixed mandatory debug 0 --- Sprint-3/2-mandatory-debug/0.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Sprint-3/2-mandatory-debug/0.js b/Sprint-3/2-mandatory-debug/0.js index b27511b41..6ab7eddb8 100644 --- a/Sprint-3/2-mandatory-debug/0.js +++ b/Sprint-3/2-mandatory-debug/0.js @@ -1,14 +1,20 @@ // Predict and explain first... - +//used log instead of return in fuction +// // =============> write your prediction here -function multiply(a, b) { +/*nction multiply(a, b) { console.log(a * b); } -console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); +console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);*/ // =============> write your explanation here // Finally, correct the code to fix the problem // =============> write your new code here +function multiply(a, b) { + return (a * b); +} + +console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); From 90d82d7016ffa0a3a600d885e435123e384f8658 Mon Sep 17 00:00:00 2001 From: Edward Kganyago Date: Tue, 29 Sep 2026 17:15:02 +0200 Subject: [PATCH 05/11] debug 0 done --- Sprint-3/2-mandatory-debug/1.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sprint-3/2-mandatory-debug/1.js b/Sprint-3/2-mandatory-debug/1.js index 37cedfbcf..8b016b6c1 100644 --- a/Sprint-3/2-mandatory-debug/1.js +++ b/Sprint-3/2-mandatory-debug/1.js @@ -1,5 +1,6 @@ // Predict and explain first... // =============> write your prediction here +//the return atement was closed without executing anything function sum(a, b) { return; @@ -11,3 +12,10 @@ console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); // =============> write your explanation here // Finally, correct the code to fix the problem // =============> write your new code here + +function sum(a, b) { + return a + b; + +} + +console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); From 494f9cb1a7b0d13a94dccdae2f1f9224a3d2649b Mon Sep 17 00:00:00 2001 From: Edward Kganyago Date: Tue, 29 Sep 2026 17:22:14 +0200 Subject: [PATCH 06/11] added comment --- Sprint-3/2-mandatory-debug/2.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-3/2-mandatory-debug/2.js b/Sprint-3/2-mandatory-debug/2.js index 57d3f5dc3..4572d89fd 100644 --- a/Sprint-3/2-mandatory-debug/2.js +++ b/Sprint-3/2-mandatory-debug/2.js @@ -2,6 +2,7 @@ // Predict the output of the following code: // =============> Write your prediction here +//no error to my accord const num = 103; From 98a2d9c8d18446434f4db2536d0f26ad4384849e Mon Sep 17 00:00:00 2001 From: Edward Kganyago Date: Tue, 29 Sep 2026 17:32:51 +0200 Subject: [PATCH 07/11] completed implimentation 1 --- Sprint-3/3-mandatory-implement/1-bmi.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-3/3-mandatory-implement/1-bmi.js b/Sprint-3/3-mandatory-implement/1-bmi.js index 58b1085f1..3aa42d9e1 100644 --- a/Sprint-3/3-mandatory-implement/1-bmi.js +++ b/Sprint-3/3-mandatory-implement/1-bmi.js @@ -15,5 +15,6 @@ // It should return a string of their Body Mass Index to 1 decimal place function calculateBMI(weight, height) { + return (height^2)(weight) // return the BMI of someone based off their weight and height } From 081abeb277dbb1195bf6e1829955e24323467ea5 Mon Sep 17 00:00:00 2001 From: Edward Kganyago Date: Wed, 30 Sep 2026 22:20:50 +0200 Subject: [PATCH 08/11] Fixed BMI --- Sprint-3/3-mandatory-implement/1-bmi.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-3/3-mandatory-implement/1-bmi.js b/Sprint-3/3-mandatory-implement/1-bmi.js index 3aa42d9e1..11c000019 100644 --- a/Sprint-3/3-mandatory-implement/1-bmi.js +++ b/Sprint-3/3-mandatory-implement/1-bmi.js @@ -15,6 +15,7 @@ // It should return a string of their Body Mass Index to 1 decimal place function calculateBMI(weight, height) { - return (height^2)(weight) + const BMI=`BMI:${height^2}*${weight}` + return BMI // return the BMI of someone based off their weight and height } From 4b5f0546e7ebdc72ab06f81001e00e6a572af3a4 Mon Sep 17 00:00:00 2001 From: Edward Kganyago Date: Wed, 30 Sep 2026 22:23:50 +0200 Subject: [PATCH 09/11] Finished cases JS --- Sprint-3/3-mandatory-implement/2-cases.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sprint-3/3-mandatory-implement/2-cases.js b/Sprint-3/3-mandatory-implement/2-cases.js index 5b0ef77ad..0956aab22 100644 --- a/Sprint-3/3-mandatory-implement/2-cases.js +++ b/Sprint-3/3-mandatory-implement/2-cases.js @@ -8,6 +8,9 @@ // Given a string input like "hello there" // When we call this function with the input string // it returns the string in UPPER_SNAKE_CASE, so "HELLO_THERE" +function toUpperSnakeCase(str) { +return str.replace(/ /g, "_").toUpperCase(); +} // Another example: "lord of the rings" should be "LORD_OF_THE_RINGS" From 0ada78306c5dea1b906b57c7a4195d8f4c9192d2 Mon Sep 17 00:00:00 2001 From: Edward Kganyago Date: Wed, 30 Sep 2026 22:30:11 +0200 Subject: [PATCH 10/11] finished mandatory implement --- Sprint-3/3-mandatory-implement/3-to-pounds.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Sprint-3/3-mandatory-implement/3-to-pounds.js b/Sprint-3/3-mandatory-implement/3-to-pounds.js index 10754da73..9aac3ce0d 100644 --- a/Sprint-3/3-mandatory-implement/3-to-pounds.js +++ b/Sprint-3/3-mandatory-implement/3-to-pounds.js @@ -4,3 +4,24 @@ // You will need to declare a function called toPounds with an appropriately named parameter. // You should call this function a number of times to check it works for different inputs +function toPounds(string){ +let penceString = string; + +const penceStringWithoutTrailingP = penceString.substring( + 0, + penceString.length - 1 +); + +const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); +const pounds = paddedPenceNumberString.substring( + 0, + paddedPenceNumberString.length - 2 +); + +const pence = paddedPenceNumberString + .substring(paddedPenceNumberString.length - 2) + .padEnd(2, "0"); +return (`£${pounds}.${pence}`); + +} +console.log(toPounds("900p")) \ No newline at end of file From dbc121da6f2815141fb53868918538c43a9a7ecd Mon Sep 17 00:00:00 2001 From: Edward Kganyago Date: Wed, 30 Sep 2026 22:40:05 +0200 Subject: [PATCH 11/11] finished sprint 3 --- Sprint-3/4-mandatory-interpret/time-format.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Sprint-3/4-mandatory-interpret/time-format.js b/Sprint-3/4-mandatory-interpret/time-format.js index c0dd9c9a5..b62c6a7f1 100644 --- a/Sprint-3/4-mandatory-interpret/time-format.js +++ b/Sprint-3/4-mandatory-interpret/time-format.js @@ -4,7 +4,6 @@ function pad(num) { numString = "0" + numString; } return numString; -} function formatTimeDisplay(seconds) { const remainingSeconds = seconds % 60; @@ -22,17 +21,25 @@ function formatTimeDisplay(seconds) { // a) When formatTimeDisplay is called how many times will pad be called? // =============> write your answer here +//3 // Call formatTimeDisplay with an input of 61, now answer the following: // b) What is the value assigned to num when pad is called for the first time? // =============> write your answer here +//0 // c) What is the return value of pad when it is called for the first time? // =============> write your answer here +//00 +// // d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer // =============> write your answer here +//01 +// // e) What is the return value of pad when it is called for the last time in this program? Explain your answer // =============> write your answer here +//00:01:01 +console.log(formatTimeDisplay(61)) \ No newline at end of file