diff --git a/assignments/bmi_calculator/bmi_calculator.js b/assignments/bmi_calculator/bmi_calculator.js index 0cdd351..ffeaa49 100644 --- a/assignments/bmi_calculator/bmi_calculator.js +++ b/assignments/bmi_calculator/bmi_calculator.js @@ -1,6 +1,13 @@ // This function should return the BMI for a person function BMICalculator(mass, height) { // Write your code here + if(mass>0 && height>0){ + BMI = mass / (height * height) + return BMI + } + else{ + return "INVALID INPUT"; + } } module.exports = BMICalculator; diff --git a/assignments/can_drive/can_drive.js b/assignments/can_drive/can_drive.js index f2f1251..9d56844 100644 --- a/assignments/can_drive/can_drive.js +++ b/assignments/can_drive/can_drive.js @@ -1,5 +1,16 @@ function CanDrive(hasDrivingLiscence, isTired, isSober) { // Write you code here + if(hasDrivingLiscence===false){ + return "You cannot drive"; + } + else if(hasDrivingLiscence===true && (isTired===true || isSober===false)){ + return "You shouldn't drive"; + } + else if(hasDrivingLiscence===true && (isTired===false || isSober===true)){ + return "You can drive"; + } } module.exports = CanDrive; + +