Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- let dohod = Number(input.shift());
- let avgUspeh = Number(input.shift());
- let minSalary = Number(input.shift());
- let socScholarship = 0;
- let uspehShcolarship = 0;
- let result;
- if (dohod < minSalary && avgUspeh > 4.5) {
- socScholarship = minSalary * 0.35;
- }
- if (avgUspeh >= 5.5) {
- uspehShcolarship = avgUspeh * 25;
- }
- if (uspehShcolarship === socScholarship && socScholarship === 0) {
- result = `You cannot get a scholarship!`;
- } else if (uspehShcolarship >= socScholarship) {
- result = `You get a scholarship for excellent results ${Math.floor(
- uspehShcolarship
- )} BGN`;
- } else {
- result = `You get a Social scholarship ${Math.floor(socScholarship)} BGN`;
- }
- console.log(result);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement