Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function oscars(input) {
- let name = input.shift();
- let startPoints = Number(input.shift());
- let tests = Number(input.shift());
- let currentPoints = 0;
- for(let i = 1; i <= tests; i++) {
- let actor = input.shift();
- let testPoints = Number(input.shift());
- currentPoints += (actor.length * testPoints) / 2;
- }
- let finalPoints = startPoints + currentPoints;
- if(finalPoints > 1250.5) {
- console.log(`Congratulations, ${name} got a nominee for leading role with ${finalPoints.toFixed(1)}!`);
- } else {
- console.log(`Sorry, ${name} you need ${(1250.5 - finalPoints).toFixed(1)} more!`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement