desito07

Scholarship

Mar 31st, 2020
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. function scholarship(input) {
  2. let income = +input.shift();
  3. let grade = +input.shift();
  4. let minSalary = +input.shift();
  5.  
  6. let schGrade = 0;
  7. let schSoc = 0;
  8.  
  9. if (income < minSalary && grade > 4.5) {
  10. schSoc = minSalary * 0.35;
  11. } else if (grade >= 5.5) {
  12. schGrade = grade * 25;
  13. }
  14. if (schSoc > schGrade) {
  15. console.log(`You get a Social scholarship ${Math.floor(schSoc)} BGN`);
  16. } else if (schGrade > schSoc) {
  17. console.log(
  18. `You get a scholarship for excellent results ${Math.floor(schGrade)} BGN`
  19. );
  20. } else {
  21. console.log(`You cannot get a scholarship!`);
  22. }
  23. }
  24. scholarship(["480.00", "4.60", "450.00"]);
  25. scholarship(["300.00", "5.65", "420.00"]);
Advertisement
Add Comment
Please, Sign In to add comment