Skip to content

Commit ec8f695

Browse files
committed
completed mandatory implement
1 parent 94be645 commit ec8f695

3 files changed

Lines changed: 24 additions & 3 deletions

File tree

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
// Then when we call this function with the weight and height
1515
// It should return their Body Mass Index to 1 decimal place
1616

17-
function calculateBMI(weight, height) {
18-
// return the BMI of someone based off their weight and height
19-
}
17+
18+
function calculateBMI(weightkg, heightm) {
19+
const BMI = (weightkg / (heightm * heightm));
20+
return BMI.toFixed(1);
21+
}
22+
let result = calculateBMI(70, 1.73);
23+
console.log (result);

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,9 @@
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+
function toUpperSnakeCase(str) {
19+
let newstr = str.replaceAll(" ", "_").toUpperCase();
20+
return newstr;
21+
}
22+
console.log(toUpperSnakeCase("lord of the rings"));

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,14 @@
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+
9+
function toPounds(pence) {
10+
const remainingPence = (pence % 100);
11+
const Pounds = (pence - remainingPence) / 100;
12+
return ${Pounds}.${remainingPence}`;
13+
}
14+
15+
console.log (toPounds(155));
16+
console.log (toPounds(99));
17+
console.log (toPounds(10000));

0 commit comments

Comments
 (0)