Skip to content

Commit 15d0324

Browse files
committed
All the mandatory implementing done
1. Calculating the BMI 2. Change a sentence from lowercase to uppersnake case 3. Changing from Kg to lb
1 parent f693105 commit 15d0324

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,11 @@
1616

1717
function calculateBMI(weight, height) {
1818
// return the BMI of someone based off their weight and height
19-
}
19+
}
20+
(calculateBMI(weight/hight*hight));
21+
let bmi = 85 / (1.54 * 1.54);
22+
console.log(bmi)
23+
//here the result was 35.833307439446366 I need to round it to 1 decimal place
24+
console.log(bmi.toFixed(1));
25+
//now the output is 35.8
26+

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,14 @@
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+
18+
// There is 2 things we need to do: change the space to_ and change the letters from lowercase to uppercase
19+
20+
function toUpperSnakeCase(str) {
21+
return str
22+
.replaceAll(' ', '_') // replace spaces with underscores
23+
.toUpperCase(); // make everything uppercase
24+
}
25+
26+
console.log(toUpperSnakeCase("hello there"));
27+
console.log(toUpperSnakeCase("lord of the rings"));

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,16 @@
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(kg) {
9+
const pounds = kg * 2.20462;
10+
11+
return pounds;
12+
}
13+
console.log(toPounds(1));
14+
console.log(toPounds(5));
15+
console.log(toPounds(10));
16+
// if I want to round the result to 2 decimal places I can use toFixed(2)
17+
console.log(toPounds(1).toFixed(2));
18+
console.log(toPounds(5).toFixed(2));
19+
console.log(toPounds(10).toFixed(2));

0 commit comments

Comments
 (0)