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 isExcellent = false;
- let isSocial = false;
- let socialSch = 0 ;
- let excellentSch = 0 ;
- if (avgGrade >= 5.50) {
- isExcellent = true;
- excellentSch = Math.floor(avgGrade * 25);
- }
- if (income < minSalary && avgGrade >= 4.50) {
- isSocial = true;
- socialSch = Math.floor(minSalary * 0.35);
- }
- if ((isSocial == false) && (isExcellent == false)){
- console.log("You cannot get a scholarship!");
- } else if (excellentSch >= socialSch){
- console.log(`You get a scholarship for excellent results ${excellentSch} BGN`);
- } else if (socialSch > excellentSch){
- console.log(`You get a Social scholarship ${socialSch} BGN`);
- }
- }
RAW Paste Data