Advertisement
Guest User

Untitled

a guest
Jun 4th, 2020
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function oscars(input) {
  2.   let name = input.shift();
  3.   let totalPoints = Number(input.shift());
  4.   let actors = Number(input.shift());
  5.  
  6.   for (let i = 1; i <= actors; i++) {
  7.     let actor = input.shift();
  8.     let testPoints = Number(input.shift());
  9.     totalPoints += (actor.length * testPoints) / 2;
  10.  
  11.     if (totalPoints > 1250.5) {
  12.       break;
  13.     }
  14.   }
  15.  
  16.   if (totalPoints > 1250.5) {
  17.     console.log(`Congratulations, ${name} got a nominee for leading role with ${totalPoints.toFixed(1)}!`);
  18.   } else {
  19.     console.log(`Sorry, ${name} you need ${(1250.5 - totalPoints).toFixed(1)} more!`);
  20.   }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement