Guest User

Scholarship

a guest
Jan 27th, 2020
93
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Scholarship(input){
  2.     let income = input.shift();
  3.     let avgGrade = input.shift();
  4.     let minSalary = input.shift();
  5.  
  6.     let isExcellent = false;
  7.     let isSocial = false;
  8.  
  9.     let socialSch = 0 ;
  10.     let excellentSch = 0 ;
  11.  
  12.     if (avgGrade >= 5.50) {
  13.         isExcellent = true;
  14.         excellentSch = Math.floor(avgGrade * 25);
  15.     }
  16.    
  17.     if (income < minSalary && avgGrade >= 4.50) {
  18.         isSocial = true;
  19.         socialSch = Math.floor(minSalary * 0.35);
  20.     }
  21.  
  22.     if ((isSocial == false) && (isExcellent == false)){
  23.         console.log("You cannot get a scholarship!");
  24.     } else if (excellentSch >= socialSch){
  25.         console.log(`You get a scholarship for excellent results ${excellentSch} BGN`);
  26.     } else if (socialSch > excellentSch){
  27.         console.log(`You get a Social scholarship ${socialSch} BGN`);
  28.     }
  29.  
  30. }
RAW Paste Data