TZinovieva

Oscars

Oct 1st, 2022
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function oscars(input) {
  2.     let actorName = input[0];
  3.     let academyPoints = Number(input[1]);
  4.     let jury = Number(input[2]);
  5.  
  6.     let totalPoints = academyPoints;
  7.  
  8.     for (let i = 3; i < input.length; i+= 2) {
  9.         let juryName = input[i];
  10.         let currentPoints = Number(input[i + 1]);
  11.  
  12.         let juryPoints = juryName.length * currentPoints / 2;
  13.         totalPoints += juryPoints;
  14.  
  15.         if (totalPoints > 1250.5) {
  16.             console.log(`Congratulations, ${actorName} got a nominee for leading role with ${totalPoints.toFixed(1)}!`);
  17.             break;
  18.         }
  19.     }
  20.         if (totalPoints < 1250.5){
  21.         console.log(`Sorry, ${actorName} you need ${(1250.5 - totalPoints).toFixed(1)} more!`);
  22.         }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment