Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Scholarship(input){
- let income = input.shift();
- let avgGrade = input.shift();
- let minSalary = input.shift();
- let scholarship = false;
- let socialSch = 0;
- let excellentSch = 0;
- if (income < minSalary && avgGrade > 4.50) {
- scholarship = true;
- socialSch = (minSalary * 0.35);
- }
- if (avgGrade >= 5.50) {
- scholarship = true;
- excellentSch = (avgGrade * 25);
- }
- if (scholarship) {
- if (socialSch > excellentSch ) {
- console.log(`You get a Social scholarship ${Math.floor(socialSch)} BGN`);
- } else {
- console.log(`You get a scholarship for excellent results ${Math.floor(excellentSch)} BGN`);
- }
- } else {
- console.log("You cannot get a scholarship!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement