From ac29a51c7e50a6765ffed2dcf13ab8523f13c3fd Mon Sep 17 00:00:00 2001 From: Swaroopaamruthwar Date: Mon, 17 Jan 2022 12:02:00 -0800 Subject: [PATCH 1/4] BMI-Calculator-Assignment --- assignments/bmi_calculator/bmi_calculator.js | 7 +++++++ 1 file changed, 7 insertions(+) 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; From 8d1b6ba94cd744bfd6fe29b705db96b82fcb0f44 Mon Sep 17 00:00:00 2001 From: Swaroopaamruthwar Date: Tue, 18 Jan 2022 13:01:13 -0800 Subject: [PATCH 2/4] CanDrive-Assignment --- assignments/can_drive/can_drive.js | 11 +++++++++++ 1 file changed, 11 insertions(+) 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; + + From a5e3ecceb01cdab88f2d17332f16d7137ca15462 Mon Sep 17 00:00:00 2001 From: Swaroopaamruthwar Date: Wed, 19 Jan 2022 13:13:47 -0800 Subject: [PATCH 3/4] favourite_movie AssignmentSubmission --- assignments/favourite_movie/favourite_movie.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/assignments/favourite_movie/favourite_movie.js b/assignments/favourite_movie/favourite_movie.js index a8148eb..cbc089f 100644 --- a/assignments/favourite_movie/favourite_movie.js +++ b/assignments/favourite_movie/favourite_movie.js @@ -2,6 +2,12 @@ const movies = []; function favouriteMovie(operation, movie) { // Write your code here + if(operation==="add"){ + movies.push(movie); + } + else if(operation==="remove"){ + movies.pop(); + } + return movies; } - module.exports = favouriteMovie; From 77148266a15534740e4875f4a5ae553c7cd49895 Mon Sep 17 00:00:00 2001 From: Swaroopaamruthwar Date: Thu, 20 Jan 2022 12:27:31 -0800 Subject: [PATCH 4/4] run_callback Assignment --- assignments/run_callback/run_callback.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assignments/run_callback/run_callback.js b/assignments/run_callback/run_callback.js index 04bf43e..6f866b4 100644 --- a/assignments/run_callback/run_callback.js +++ b/assignments/run_callback/run_callback.js @@ -1,5 +1,7 @@ function RunCallback(a, b, cb) { // Write you code here, you need to add a and b, pass the result into callback function cb as argument return the result + var sum=a+b; + return cb(sum); } module.exports = RunCallback;