Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function scholarship(input) {
- let income = Number(input.shift());
- let avgSuccesses = Number(input.shift());
- let minSalary = Number(input.shift());
- let socialScholarship = minSalary * 0.35;
- let excellentScoreScholarship = avgSuccesses * 25;
- if ((avgSuccesses < 4.5) || (income > minSalary)) {
- console.log("You cannot get a scholarship!");
- return;
- } else if ((avgSuccesses > 4.5) || (income < minSalary) , (socialScholarship > excellentScoreScholarship)) {
- console.log(`You get a Social scholarship ${Math.floor(socialScholarship)} BGN`);
- return;
- } else if ((avgSuccesses > 5.5) ,(excellentScoreScholarship >= socialScholarship)) {
- console.log(`You get a scholarship for excellent results ${Math.floor(excellentScoreScholarship)} BGN`);
- return;
- }
- }
- scholarship([480.00, 4.60, 450.00]);
- scholarship([300.00, 5.65, 420.00]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement