Advertisement
Liliana797979

solarship viarno reshenie

Jan 27th, 2021
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 08. Scholarship (not included in final score)
  2.  
  3. function solve(arg) {
  4.     let income = Number(arg[0]);
  5.     let degree = Number(arg[1]);
  6.     let minSalary = Number(arg[2]);
  7.  
  8.     let isStpend = false;
  9.     let socialStipend = 0;
  10.     if (income < minSalary) {
  11.         if (degree > 4.5) {
  12.             socialStipend = 0.35 * minSalary;
  13.             // console.log(`socialStipend = ${socialStipend}`);
  14.             isStpend = true;
  15.         }
  16.     }
  17.     let excellentStipend = 0;
  18.     if (degree >= 5.5) {
  19.         excellentStipend = 25 * degree;
  20.         // console.log(`excellentStipend = ${excellentStipend}`);
  21.         isStpend = true;
  22.     }
  23.  
  24.     if (isStpend === false) {
  25.         console.log("You cannot get a scholarship!");
  26.     } else {
  27.         if (socialStipend > excellentStipend) {
  28.             console.log(`You get a Social scholarship ${Math.floor(socialStipend)} BGN`);
  29.         } else {
  30.             console.log(`You get a scholarship for excellent results ${Math.floor(excellentStipend)} BGN`);
  31.         }
  32.     }
  33. }
  34.  
  35. solve(["300.00", "5.65", "420.00"]) ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement