Advertisement
dimoBs

Untitled

Oct 21st, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. function solve(input) {
  2. let index = 0;
  3. let jury = Number(input[index]);
  4. index++;
  5. let nameOfPrezentation = input[index];
  6. let command = "";
  7. let sum = 0;
  8. let commandN = 0;
  9. let total = 0;
  10. let counter = 0;
  11.  
  12. while (command !== "Finish") {
  13. sum = 0;
  14. for (let i = 1; i <= jury; i++) {
  15. index++;
  16. command = input[index];
  17. commandN = Number(command);
  18. sum += commandN;
  19.  
  20. }
  21. counter++;
  22. sum = sum / jury;
  23. total += sum;
  24.  
  25. console.log(`${nameOfPrezentation} - ${sum.toFixed(2)}.`);
  26. index++;
  27. command = input[index];
  28. nameOfPrezentation = input[index];
  29.  
  30. }
  31. total = (total / counter).toFixed(2);
  32.  
  33. console.log(`Student's final assessment is ${total}.`)
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement