kstoyanov

Untitled

Feb 20th, 2020
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. problem 08. Scholarship
  2.  
  3. function solve(arg){
  4.  
  5.     let incomeBGN = Number(arg.shift());
  6.     let avGrade = Number(arg.shift());
  7.     let minSalary = Number(arg.shift());
  8.  
  9.     let socScholarship = 0;
  10.     let scholarship = 0;
  11.  
  12.     if (avGrade <= 4.50) {
  13.  
  14.         console.log(`You cannot get a scholarship!`);
  15.  
  16.     } else if (avGrade < 5.50) {
  17.  
  18.         if (incomeBGN < minSalary) {
  19.  
  20.             socScholarship = Math.floor(0.35 * minSalary);
  21.  
  22.             console.log(`You get a Social scholarship ${socScholarship} BGN`);
  23.  
  24.         } else {
  25.  
  26.             console.log(`You cannot get a scholarship!`);
  27.         };
  28.  
  29.     } else {
  30.  
  31.         scholarship = Math.floor(avGrade * 25);
  32.  
  33.         if (incomeBGN < minSalary){
  34.  
  35.             socScholarship = Math.floor(0.35 * minSalary);
  36.  
  37.         };
  38.  
  39.         if (socScholarship > scholarship) {
  40.  
  41.             console.log(`You get a Social scholarship ${socScholarship} BGN`);
  42.  
  43.         } else {
  44.  
  45.             console.log(`You get a scholarship for excellent results ${scholarship} BGN`);
  46.  
  47.         };
  48.  
  49.     };
  50.    
  51. };
Add Comment
Please, Sign In to add comment