Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. function solve(input) {
  2. let dohod = Number(input.shift());
  3. let avgUspeh = Number(input.shift());
  4. let minSalary = Number(input.shift());
  5. let socScholarship = 0;
  6. let uspehShcolarship = 0;
  7. let result;
  8.  
  9. if (dohod < minSalary && avgUspeh > 4.5) {
  10. socScholarship = minSalary * 0.35;
  11. }
  12.  
  13. if (avgUspeh >= 5.5) {
  14. uspehShcolarship = avgUspeh * 25;
  15. }
  16.  
  17. if (uspehShcolarship === socScholarship && socScholarship === 0) {
  18. result = `You cannot get a scholarship!`;
  19. } else if (uspehShcolarship >= socScholarship) {
  20. result = `You get a scholarship for excellent results ${Math.floor(
  21. uspehShcolarship
  22. )} BGN`;
  23. } else {
  24. result = `You get a Social scholarship ${Math.floor(socScholarship)} BGN`;
  25. }
  26.  
  27. console.log(result);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement