Advertisement
Guest User

Untitled

a guest
May 26th, 2019
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. function scholarships(input){
  2. let income = Number(input.shift());
  3. let averageResults = Number(input.shift());
  4. let minSalary = Number(input.shift());
  5. let socialScholarship = Math.floor(minSalary/100*35);
  6. let academicScholarship = Math.floor(averageResults*25);
  7. let socialMore = true;
  8.  
  9. let socialScholarshipRight = true;
  10. let academicScholarshipRight = true;
  11.  
  12. if ((income>minSalary) || (averageResults<=4.5)){
  13. socialScholarshipRight = !socialScholarshipRight;
  14. }
  15.  
  16. if (averageResults<5.5){
  17. academicScholarshipRight = !academicScholarshipRight;
  18. }
  19.  
  20. if (socialScholarship<academicScholarship){
  21. socialMore=false;
  22. }
  23.  
  24. if (socialScholarshipRight==false && academicScholarshipRight==false){
  25. console.log("You cannot get a scholarship!");
  26. } else if (socialScholarshipRight==true && socialMore==true){
  27. console.log(`You get a Social scholarship ${socialScholarship} BGN`);
  28. } else if (academicScholarshipRight==true && socialMore==false){
  29. console.log(`You get a scholarship for excellent results ${academicScholarship} BGN`);
  30. }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement