Advertisement
remico

Untitled

Oct 1st, 2023
843
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function oscars (inputArray){
  2. let actorNameInput = inputArray [0];
  3. let academiPoints = Number (inputArray [1]); //205
  4. let juryCountInput = Number (inputArray [2]);//4
  5.  
  6. for (let i = 3; i < juryCountInput ; i +=2){
  7.     let juryName = inputArray [i];
  8.     let juryPoints = Number (inputArray [i +1]);
  9.     let poinsWon = juryName.length * juryPoints / 2;
  10.     academiPoints += poinsWon
  11.  
  12.    
  13.     if  (academiPoints > 1250.50){
  14.         console.log (`Congratulations, ${actorNameInput} got a nominee for leading role with ${academiPoints.toFixed(1)}!`);
  15.         break;
  16.     }
  17.     if (academiPoints <= 1250.50) {
  18.         let pointsNeeded = 1250.50 - academiPoints;
  19.         console.log (`Sorry, ${actorNameInput} you need ${pointsNeeded.toFixed(1)} more!`);
  20.     }  
  21. }
  22. }
  23. //oscars (["Zahari Baharov","205","4","Johnny Depp","45","Will Smith","29","Jet Lee","10","Matthew Mcconaughey","39"]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement