Vassil_Iliev

LunchTime

Feb 18th, 2022
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function lunchBreak(input) {
  2.     let nameOfSeries = input[0];
  3.     let episodeLength = +input[1];
  4.     let restDuration = +input[2];
  5.     let lunchDuration = restDuration * 0.125;
  6.     let chillDuration = restDuration * 0.25;
  7.     let timeToWatch = restDuration - lunchDuration - chillDuration;
  8.     if (timeToWatch >= episodeLength) {
  9.         console.log(`You have enough time to watch ${nameOfSeries} and left with ${Math.ceil(Math.abs(timeToWatch - episodeLength))} minutes free time.`)
  10.     } else {
  11.         console.log(`You don't have enough time to watch ${nameOfSeries}, you need ${Math.ceil(Math.abs(timeToWatch - episodeLength))} more minutes.`)
  12.    }
  13.  
  14. }
Advertisement
Add Comment
Please, Sign In to add comment