Advertisement
Aliendreamer

html grade

Feb 21st, 2019
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(examPoints,homework,totalHomeworks){
  2.     let maxPoints=100;
  3.     let examPointsTotal=400;
  4.     const percentOfExam=0.9;
  5.     let examResult=(examPoints/examPointsTotal)*100;
  6.     let resultFromExam= examResult*percentOfExam;
  7.     let bonus=(homework/totalHomeworks);
  8.     let totalBonus=10*bonus;
  9.     let total=resultFromExam+totalBonus;
  10.  
  11.     if(examPoints===examPointsTotal){
  12.          let FinalGrade=6;
  13.          return FinalGrade.toFixed(2);
  14.     }
  15.     let grade = 3 + 2 * (total-maxPoints / 5) / (maxPoints / 2);
  16.  
  17.     if(grade<3.00){
  18.         let FinalGrade=2;
  19.         return FinalGrade.toFixed(2);
  20.     }
  21.     if(grade>6.00){
  22.         let FinalGrade=6;
  23.          return FinalGrade.toFixed(2);
  24.     }
  25.     return grade.toFixed(2);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement