TZinovieva

Cat Walking

Jan 3rd, 2023
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function catWalking(input) {
  2.     let minutesPerWalk = Number(input[0]);
  3.     let walksNumber = Number(input[1]);
  4.     let caloriesIntake = Number(input[2]);
  5.  
  6.     let totalMinutes = minutesPerWalk * walksNumber;
  7.     let caloriesBurned = totalMinutes * 5;
  8.  
  9.     let halfIntake = caloriesIntake / 2;
  10.  
  11.     if (caloriesBurned >= halfIntake) {
  12.         console.log(`Yes, the walk for your cat is enough. Burned calories per day: ${caloriesBurned}.`);
  13.     } else {
  14.         console.log(`No, the walk for your cat is not enough. Burned calories per day: ${caloriesBurned}.`);
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment