Advertisement
svephoto

Scholarship [JavaScript]

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