View difference between Paste ID: rDPScuSX and 2KbkvxRX
SHOW: | | - or go back to the newest paste.
1
function oscars(input) {
2
  let index = 0;
3
  let actorName = input[index];
4
  index++;
5
  let scoreFromAcademy = Number(input[index]);
6
  index++;
7
  let juriCount = Number(input[index]);
8
  index++;
9
  let totalScore = Number(scoreFromAcademy)
10
  let isEnoughScore = false
11
12
  for (let i = 0; i < juriCount; i++) {
13
    let currentJuriName = input[index];
14
    index++;
15
    let scoreGiven = Number(input[index]);
16
    index++;
17
    totalScore += (currentJuriName.length * scoreGiven) / 2;
18
19
    if (totalScore >= 1250.5) {
20
      isEnoughScore = true
21
      break;
22
    }
23
24
  }
25
  if (totalScore >= 1250.5) {
26
    console.log(`Congratulations, ${actorName} got a nominee for leading role with ${totalScore.toFixed(1)}!`);
27
  } else {
28
    console.log(`Sorry, ${actorName} you need ${Math.abs(1250.5 - totalScore).toFixed(1)} more!`);
29
  }
30
}
31
oscars(["Sandra Bullock",
32
"340",
33
"5",
34
"Robert De Niro",
35
"50",
36
"Julia Roberts",
37
"40.5",
38
"Daniel Day-Lewis",
39
"39.4",
40
"Nicolas Cage",
41
"29.9",
42
"Stoyanka Mutafova",
43
"33"])
44