vborislavova

08. Scholarship - Conditional Statements - Exercise

Feb 22nd, 2020
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function scholarship(input) {
  2.     let incomeInLv = Number(input.shift());
  3.     let avgSuccess = Number(input.shift());
  4.     let minSalary = Number(input.shift());
  5.    
  6.     let schoShip1 = 0.0;
  7.     let schoShip2 = 0.0;
  8.  
  9.     if (incomeInLv < minSalary && avgSuccess > 4.50) {
  10.         schoShip1 = minSalary * 0.35;
  11.     }
  12.     if (avgSuccess >= 5.5) {
  13.         schoShip2 = avgSuccess * 25;
  14.     }
  15.  
  16.      if (schoShip1 > schoShip2) {
  17.         console.log(`You get a Social scholarship ${Math.floor(schoShip1)} BGN`);
  18.  
  19.     } else if (schoShip2 > schoShip1) {
  20.         console.log(`You get a scholarship for excellent results ${Math.floor(schoShip2)} BGN`);
  21.        
  22.     } else {
  23.         console.log(`You cannot get a scholarship!`);
  24.     }
  25. }
Add Comment
Please, Sign In to add comment