Advertisement
Vaniela

Scholarship

Mar 31st, 2020
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. function scholarship(income, avgSucc, minSalary) {
  2. income = +income;
  3. avgSucc = +avgSucc;
  4. minSalary = +minSalary;
  5. let socialScholarship = minSalary * 0.35;
  6. let excellentScholarship = avgSucc * 25;
  7. if (
  8. avgSucc >= 5.5 &&
  9. income < minSalary &&
  10. socialScholarship >= excellentScholarship
  11. ) {
  12. console.log(
  13. `You get a Social scholarship ${Math.floor(socialScholarship)} BGN`
  14. );
  15. } else if (
  16. avgSucc >= 5.5 &&
  17. income < minSalary &&
  18. socialScholarship < excellentScholarship
  19. ) {
  20. console.log(
  21. `You get a scholarship for excellent results ${Math.floor(
  22. excellentScholarship
  23. )} BGN`
  24. );
  25. } else if (avgSucc > 4.5 && income < minSalary) {
  26. console.log(
  27. `You get a Social scholarship ${Math.floor(socialScholarship)} BGN`
  28. );
  29. } else if (avgSucc >= 5.5) {
  30. console.log(
  31. `You get a scholarship for excellent results ${Math.floor(
  32. excellentScholarship
  33. )} BGN`
  34. );
  35. } else {
  36. console.log(`You cannot get a scholarship!`);
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement