Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. function solve(input) {
  2. let income = Number(input.shift())
  3. let avgGrade = Number(input.shift())
  4. let minSalary = Number(input.shift())
  5.  
  6. let isExcellent = false;
  7. let isSocial = false;
  8.  
  9. let socialSch = 0
  10. let excellentSch = 0
  11.  
  12. if (avgGrade >= 5.5) {
  13. isExcellent = true;
  14. excellentSch = Math.floor(avgGrade * 25)
  15.  
  16. }
  17.  
  18. if (income <= minSalary && avgGrade >= 4.50) {
  19. isSocial = true;
  20. socialSch = Math.floor(minSalary * 0.35)
  21. }
  22.  
  23. if (socialSch < excellentSch) {
  24. console.log (`You get a scholarship for excellent results ${excellentSch} BGN`)
  25. }
  26. else if (excellentSch < socialSch) {
  27. console.log (`You get a Social scholarship ${socialSch} BGN`)
  28. }
  29. else {
  30. console.log ("You cannot get a scholarship!")
  31. }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement