Advertisement
Spocoman

Movie Day

Feb 24th, 2022
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function movieDay(input) {
  2.     let movieTime = Number(input[0]);
  3.     let scene = Number(input[1]);
  4.     let sceneTime = Number(input[2]);
  5.  
  6.     let total = 0.15 * movieTime + scene * sceneTime;
  7.  
  8.     if (total >= movieTime) {
  9.         console.log(`Time is up! To complete the movie you need ${Math.round(total - movieTime)} minutes.`);
  10.     } else {
  11.         console.log(`You managed to finish the movie on time! You have ${Math.round(movieTime - total)} minutes left!`);
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement