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