Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function grade(examPoints, homeworkPoints, totalHomework) {
- let maxPoints = 100;
- let totalPoints = (((examPoints * 100) / 400) * 0.9) + ((homeworkPoints * 100 / totalHomework) * 0.1);
- let grade = 3 + 2 * (totalPoints - maxPoints / 5) / (maxPoints / 2);
- if (examPoints === 400) {
- console.log((6).toFixed(2));
- } else if (grade < 3) {
- console.log((2).toFixed(2));
- } else if (grade > 6) {
- console.log((6).toFixed(2));
- } else {
- console.log(grade.toFixed(2));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement