Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. function approvedForScholarship(input) {
  2. let earnings = Number(input.shift());
  3. let averageGrade = Number(input.shift());
  4. let minSalary = Number(input.shift());
  5. let socialScholarship = 0;
  6. let scholarship = 0;
  7.  
  8. if (earnings < minSalary && averageGrade > 4.5) {
  9. socialScholarship = minSalary * 0.35;
  10. } else if (averageGrade >= 5.5) {
  11. scholarship = averageGrade * 25;
  12. }
  13.  
  14. // if (socialScholarship > scholarship) {
  15. // console.log(`You get a Social scholarship ${Math.floor(socialScholarship)} BGN`);
  16. // } else if (scholarship >= socialScholarship && scholarship > 0) {
  17. // console.log(`You get a scholarship for excellent results ${Math.floor(scholarship)} BGN`);
  18. // } else if (scholarship === 0 && socialScholarship === 0) {
  19. // console.log('You cannot get a scholarship!');
  20. // }
  21.  
  22. if (scholarship !== 0 || socialScholarship !== 0) {
  23. if (socialScholarship > scholarship) {
  24. console.log(`You get a Social scholarship ${Math.floor(socialScholarship)} BGN`);
  25. } else {
  26. console.log(`You get a scholarship for excellent results ${Math.floor(scholarship)} BGN`);
  27. }
  28. } else {
  29. console.log('You cannot get a scholarship!');
  30. }
  31.  
  32. }
  33.  
  34. approvedForScholarship(['300.00','5.65','420.00']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement