Liliana797979

stipendii

Jan 17th, 2021
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function scolarship(input) {
  2.     let incomeInLv = Number(input[0]);
  3.     let avarageGrade = Number(input[1]);
  4.     let minSalary = Number(input[2]);
  5.     let socialScolarshipMoney = 0;
  6.     let gradeSholarshipMoney = 0
  7.  
  8.     let isShcolarship = false;
  9.     let isSocialScolarship = false;
  10.  
  11.     if (incomeInLv < minSalary) {
  12.         isSocialScolarship = true;
  13.         isShcolarship = true;
  14.     }
  15.     if (avarageGrade < 4.5) {
  16.         isSocialScolarship = false;
  17.         isShcolarship = false;
  18.  
  19.     }
  20.  
  21.     if (isSocialScolarship) {
  22.         socialScolarshipMoney = Math.floor(minSalary * 0.35);
  23.     }
  24.     if (avarageGrade >= 5.5) {
  25.         gradeSholarshipMoney = Math.floor(avarageGrade * 25);
  26.         isShcolarship = true;
  27.     }
  28.     if (!isShcolarship) {
  29.         console.log("You cannot get a scholarship!");
  30.  
  31.     } else if (gradeSholarshipMoney >= socialScolarshipMoney) {
  32.         console.log(`You get a scholarship for excellent results ${gradeSholarshipMoney} BGN`);
  33.     } else if (socialScolarshipMoney > gradeSholarshipMoney) {
  34.         console.log(`You get a Social scholarship ${socialScolarshipMoney} BGN`);
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment