Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(monthlyIncome, avgGrade, minWage) {
- monthlyIncome = Number(monthlyIncome);
- avgGrade = Number(avgGrade);
- minWage = Number(minWage);
- socialScholarship = 0;
- excellentScholarship = 0;
- if (monthlyIncome < minWage && avgGrade >= 4.5) {
- socialScholarship = minWage * 0.35;
- } else if (avgGrade >= 5.5) {
- excellentScholarship = avgGrade * 25;
- }
- if (socialScholarship === 0 && excellentScholarship === 0) {
- console.log('You cannot get a scholarship!');
- } else if (socialScholarship > excellentScholarship) {
- console.log(`You get a Social scholarship ${Math.floor(socialScholarship)} BGN`);
- } else if (excellentScholarship >= socialScholarship) {
- console.log(`You get a scholarship for excellent results ${Math.floor(excellentScholarship)} BGN`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement