Skip to content

Commit c56bd67

Browse files
committed
revert multiple commits that were from sprint 2
1 parent 3ca95c6 commit c56bd67

File tree

7 files changed

+17
-113
lines changed

7 files changed

+17
-113
lines changed

Sprint-2/2-mandatory-debug/0.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11
// Predict and explain first...
22

33
// =============> write your prediction here
4-
//line 7 will log the result of a * b, line 10 will throw an error since the function does not return anything so it will say The result of multiplying 10 and 32 is undefined.
54

6-
//function multiply(a, b) {
7-
// console.log(a * b);
8-
//}
5+
function multiply(a, b) {
6+
console.log(a * b);
7+
}
98

10-
//console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
9+
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1110

1211
// =============> write your explanation here
13-
//since the function does not return a value we get undefined passed back to the console.
1412

1513
// Finally, correct the code to fix the problem
1614
// =============> write your new code here
17-
function multiply(a, b) {
18-
return a * b;
19-
}
20-
21-
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);

Sprint-2/2-mandatory-debug/1.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
// Predict and explain first...
22
// =============> write your prediction here
3-
// the console will show The sum of 10 and 32 is undefined, this is because the return command is before the calculation so the return has no value to bring back.
43

5-
//function sum(a, b) {
6-
// return;
7-
// a + b;
8-
//}
4+
function sum(a, b) {
5+
return;
6+
a + b;
7+
}
98

10-
//console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
9+
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
1110

1211
// =============> write your explanation here
13-
//the console will show The sum of 10 and 32 is undefined, this is because the return command is before the calculation so the return has no value to bring back.
1412
// Finally, correct the code to fix the problem
1513
// =============> write your new code here
16-
function sum(a, b) {
17-
return a + b;
18-
}
19-
20-
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);

Sprint-2/3-mandatory-implement/1-bmi.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,5 @@
1515
// It should return their Body Mass Index to 1 decimal place
1616

1717
function calculateBMI(weight, height) {
18-
// return the BMI of someone based off their weight and height
19-
const bmi = weight / height ** 2;
20-
return bmi.toFixed(1);
21-
}
22-
23-
console.log(`Your BMI is ${calculateBMI(70, 1.73)}`);
24-
25-
//const actualOutput = calculateBMI(70, 1.73);
26-
//const targetOutput = "23.4";
27-
28-
//console.assert(actualOutput === targetOutput, `That is not the correct BMI`);
18+
// return the BMI of someone based off their weight and height
19+
}

Sprint-2/3-mandatory-implement/2-cases.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,3 @@
1414
// You will need to come up with an appropriate name for the function
1515
// Use the MDN string documentation to help you find a solution
1616
// This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase
17-
function convertToSnakeCase(inputStr) {
18-
const newStr = inputStr.toUpperCase().replaceAll(" ", "_");
19-
return newStr;
20-
}
21-
22-
console.log(convertToSnakeCase("hello there"));

Sprint-2/3-mandatory-implement/3-to-pounds.js

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,3 @@
44
// You will need to declare a function called toPounds with an appropriately named parameter.
55

66
// You should call this function a number of times to check it works for different inputs
7-
8-
function toPounds(penceString) {
9-
const penceStringWithoutTrailingP = penceString.substring(
10-
0,
11-
penceString.length - 1
12-
);
13-
14-
const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");
15-
const pounds = paddedPenceNumberString.substring(
16-
0,
17-
paddedPenceNumberString.length - 2
18-
);
19-
20-
const pence = paddedPenceNumberString
21-
.substring(paddedPenceNumberString.length - 2)
22-
.padEnd(2, "0");
23-
24-
return ${pounds}.${pence}`;
25-
}
26-
27-
console.log(toPounds("399p"));
28-
29-
const actualOutput = toPounds("4685p");
30-
const expectedOutput = "£46.85";
31-
32-
console.assert(
33-
actualOutput === expectedOutput,
34-
`expected to get ${expectedOutput}, but got ${actualOutput}`
35-
);
36-
37-
const actualOutput1 = toPounds("123456p");
38-
const expectedOutput1 = "£1234.56";
39-
40-
console.assert(
41-
actualOutput1 === expectedOutput1,
42-
`expected to get ${expectedOutput1}, but got ${actualOutput1}`
43-
);
44-
45-
const actualOutput2 = toPounds("4p");
46-
const expectedOutput2 = "£0.04";
47-
48-
console.assert(
49-
actualOutput2 === expectedOutput2,
50-
`expected to get ${expectedOutput2}, but got ${actualOutput2}`
51-
);

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,24 @@ function formatTimeDisplay(seconds) {
1111
return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`;
1212
}
1313

14-
console.log(formatTimeDisplay(61));
15-
1614
// You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit
1715
// to help you answer these questions
1816

1917
// Questions
2018

2119
// a) When formatTimeDisplay is called how many times will pad be called?
22-
// =============> write your answer here it will be called 3 times
20+
// =============> write your answer here
2321

2422
// Call formatTimeDisplay with an input of 61, now answer the following:
2523

2624
// b) What is the value assigned to num when pad is called for the first time?
27-
// =============> write your answer here num = 0 on the first call
25+
// =============> write your answer here
2826

2927
// c) What is the return value of pad is called for the first time?
30-
// =============> write your answer here return value = "00"
28+
// =============> write your answer here
3129

3230
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
33-
// =============> write your answer here num = 1 when called for the last time because remainingSeconds has a value of 1 from 61%60 = 1
31+
// =============> write your answer here
3432

3533
// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
36-
// =============> write your answer here return value will be "01" since num has 1 digit pad adds a 0 to the start to make it 2 digits.
34+
// =============> write your answer here

Sprint-2/5-stretch-extend/format-time.js

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,8 @@
44

55
function formatAs12HourClock(time) {
66
const hours = Number(time.slice(0, 2));
7-
const minutes = time.slice(3);
8-
console.log(minutes);
9-
if (hours == 12) {
10-
return `${hours}:${minutes} pm`;
11-
}
12-
137
if (hours > 12) {
14-
return `${hours - 12}:${minutes} pm`;
8+
return `${hours - 12}:00 pm`;
159
}
1610
return `${time} am`;
1711
}
@@ -29,17 +23,3 @@ console.assert(
2923
currentOutput2 === targetOutput2,
3024
`current output: ${currentOutput2}, target output: ${targetOutput2}`
3125
);
32-
33-
const currentOutput3 = formatAs12HourClock("23:30");
34-
const targetOutput3 = "11:30 pm";
35-
console.assert(
36-
currentOutput3 === targetOutput3,
37-
`current output: ${currentOutput3}, target output: ${targetOutput3}`
38-
);
39-
40-
const currentOutput4 = formatAs12HourClock("12:01");
41-
const targetOutput4 = "12:01 pm";
42-
console.assert(
43-
currentOutput4 === targetOutput4,
44-
`current output: ${currentOutput4}, target output: ${targetOutput4}`
45-
);

0 commit comments

Comments
 (0)