Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function oscars(input) {
- let actorName = input[0];
- let academyPoints = Number(input[1]);
- let jury = Number(input[2]);
- let totalPoints = academyPoints;
- for (let i = 3; i < input.length; i+= 2) {
- let juryName = input[i];
- let currentPoints = Number(input[i + 1]);
- let juryPoints = juryName.length * currentPoints / 2;
- totalPoints += juryPoints;
- if (totalPoints > 1250.5) {
- console.log(`Congratulations, ${actorName} got a nominee for leading role with ${totalPoints.toFixed(1)}!`);
- break;
- }
- }
- if (totalPoints < 1250.5){
- console.log(`Sorry, ${actorName} you need ${(1250.5 - totalPoints).toFixed(1)} more!`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment