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