Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function oscars (inputArray){
- let actorNameInput = inputArray [0];
- let academiPoints = Number (inputArray [1]); //205
- let juryCountInput = Number (inputArray [2]);//4
- for (let i = 3; i < juryCountInput ; i +=2){
- let juryName = inputArray [i];
- let juryPoints = Number (inputArray [i +1]);
- let poinsWon = juryName.length * juryPoints / 2;
- academiPoints += poinsWon
- if (academiPoints > 1250.50){
- console.log (`Congratulations, ${actorNameInput} got a nominee for leading role with ${academiPoints.toFixed(1)}!`);
- break;
- }
- if (academiPoints <= 1250.50) {
- let pointsNeeded = 1250.50 - academiPoints;
- console.log (`Sorry, ${actorNameInput} you need ${pointsNeeded.toFixed(1)} more!`);
- }
- }
- }
- //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