Advertisement
Liliana797979

movie day

Jan 18th, 2021
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function movieDay(input) {
  2.     let timeForPhotos = Number(input[0]);
  3.     let scenesCount = Number(input[1]);
  4.     let sceneDuration = Number(input[2]);
  5.  
  6.     let fieldPreparation = timeForPhotos * 0.15;
  7.     let timeScenes = scenesCount * sceneDuration;
  8.     let totalTime = fieldPreparation + timeScenes;
  9.  
  10.     if (timeForPhotos >= totalTime) {
  11.         console.log(`You managed to finish the movie on time! You have ${(Math.abs)(totalTime - timeForPhotos)} minutes left!`);
  12.     } else {
  13.         console.log(`Time is up! To complete the movie you need ${(Math.abs)(timeForPhotos - totalTime)} minutes.`);
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement