audipower

scholarship

Mar 3rd, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function scholarship(input){
  2.     let income = Number(input[0]);
  3.     let grade = Number(input[1]);
  4.     let salary = Number(input[2]);
  5.  
  6.     let social = salary * 0.35;
  7.     let excellent = grade * 25;
  8.    
  9.     if (income < salary && grade <= 4.5){
  10.         console.log('You cannot get a scholarship!');
  11.     } else if (income < salary && grade < 5.5){
  12.         console.log(`You get a Social scholarship ${Math.floor(social)} BGN`);
  13.     } else if (income < salary && grade >= 5.5){
  14.         excellent >= social ? console.log(`You get a scholarship for excellent results ${Math.floor(excellent)} BGN`) : console.log(`You get a Social scholarship ${Math.floor(social)} BGN`);
  15.     } else if (income >= salary && grade >= 5.5){
  16.         console.log(`You get a scholarship for excellent results ${Math.floor(excellent)} BGN`);
  17.     } else if (income >= salary && grade < 5.5){
  18.         console.log('You cannot get a scholarship!');
  19.     }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment