# Untitled

a guest
Aug 30th, 2017
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. function solve(input) {
2. let output = '';
3. input = input.filter(function(e){return e });
4. let examString = input[input.length - 1].trim();
5. let examAvg = [];
6. for (let i = 0; i < input.length - 1; i++) {
7. let data = input[i].split(' ');
8. data = data.filter(function (e) { return e });
9. let name = data[0];
10. let exam = data[1];
11. let points = Number(data[2]);
12. let bonuses = Number(data[3]);
13. let examPoints = (points / 5) + bonuses;
14. let grade = (((examPoints / 80) * 4) + 2).toFixed(2);
16. if (grade > 6.00) {
18. } else {
20. }
21. if (points < 100) {
22. output += name + ' failed at "' + exam + '"\n';
23. // console.log(`\${name} failed at "\${exam}"`);
24. } else {
25. output += name + ': Exam - "' + exam + '"; Points - ' + examPoints + '; Grade - ' + finalGrade + '\n';
27. }
28. if (examString === exam) {
29. examAvg.push(points);
30. }
31. }
32. let sum = 0;
33. for (let grade of examAvg) {