Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function scholarships(input){
- let income = Number(input.shift());
- let averageResults = Number(input.shift());
- let minSalary = Number(input.shift());
- let socialScholarship = Math.floor(minSalary/100*35);
- let academicScholarship = Math.floor(averageResults*25);
- let socialMore = true;
- let socialScholarshipRight = true;
- let academicScholarshipRight = true;
- if ((income>minSalary) || (averageResults<=4.5)){
- socialScholarshipRight = !socialScholarshipRight;
- }
- if (averageResults<5.5){
- academicScholarshipRight = !academicScholarshipRight;
- }
- if (socialScholarship<academicScholarship){
- socialMore=false;
- }
- if (socialScholarshipRight==false && academicScholarshipRight==false){
- console.log("You cannot get a scholarship!");
- } else if (socialScholarshipRight==true && socialMore==true){
- console.log(`You get a Social scholarship ${socialScholarship} BGN`);
- } else if (academicScholarshipRight==true && socialMore==false){
- console.log(`You get a scholarship for excellent results ${academicScholarship} BGN`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement