Spocoman

08. Lunch Break

Dec 16th, 2021 (edited)
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function lunchBreak(input) {
  2.  
  3.     let serialName = input[0];
  4.     let serialTime = Number(input[1]);
  5.     let breakTime = Number(input[2]);
  6.  
  7.     let neededTime = breakTime / 8 + breakTime / 4 + serialTime;
  8.  
  9.     if (neededTime <= breakTime){
  10.         console.log(`You have enough time to watch ${serialName} and left with ${breakTime - Math.floor(neededTime)} minutes free time.`);
  11.     }
  12.     else{
  13.         console.log(`You don't have enough time to watch ${serialName}, you need ${Math.ceil(neededTime) - breakTime} more minutes.`);
  14.    }
  15.  
  16. }
  17.  
Add Comment
Please, Sign In to add comment