Guest User

js

a guest
Jan 28th, 2020
84
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 scholarship = false;
  7.  
  8.     let socialSch = 0;
  9.     let excellentSch = 0;
  10.  
  11.     if (income < minSalary && avgGrade > 4.50) {
  12.         scholarship = true;
  13.         socialSch = (minSalary * 0.35);
  14.     }
  15.  
  16.     if (avgGrade >= 5.50) {
  17.         scholarship = true;
  18.         excellentSch = (avgGrade * 25);
  19.     }
  20.  
  21.     if (scholarship) {
  22.         if (socialSch > excellentSch ) {
  23.             console.log(`You get a Social scholarship ${Math.floor(socialSch)} BGN`);  
  24.         } else {
  25.             console.log(`You get a scholarship for excellent results ${Math.floor(excellentSch)} BGN`);
  26.         }
  27.     } else {
  28.         console.log("You cannot get a scholarship!");
  29.     }
  30. }
RAW Paste Data