Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- problem 08. Scholarship
- function solve(arg){
- let incomeBGN = Number(arg.shift());
- let avGrade = Number(arg.shift());
- let minSalary = Number(arg.shift());
- let socScholarship = 0;
- let scholarship = 0;
- if (avGrade <= 4.50) {
- console.log(`You cannot get a scholarship!`);
- } else if (avGrade < 5.50) {
- if (incomeBGN < minSalary) {
- socScholarship = Math.floor(0.35 * minSalary);
- console.log(`You get a Social scholarship ${socScholarship} BGN`);
- } else {
- console.log(`You cannot get a scholarship!`);
- };
- } else {
- scholarship = Math.floor(avGrade * 25);
- if (incomeBGN < minSalary){
- socScholarship = Math.floor(0.35 * minSalary);
- };
- if (socScholarship > scholarship) {
- console.log(`You get a Social scholarship ${socScholarship} BGN`);
- } else {
- console.log(`You get a scholarship for excellent results ${scholarship} BGN`);
- };
- };
- };
Add Comment
Please, Sign In to add comment