Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 08. Scholarship (not included in final score)
- function solve(arg) {
- let income = Number(arg[0]);
- let degree = Number(arg[1]);
- let minSalary = Number(arg[2]);
- let isStpend = false;
- let socialStipend = 0;
- if (income < minSalary) {
- if (degree > 4.5) {
- socialStipend = 0.35 * minSalary;
- // console.log(`socialStipend = ${socialStipend}`);
- isStpend = true;
- }
- }
- let excellentStipend = 0;
- if (degree >= 5.5) {
- excellentStipend = 25 * degree;
- // console.log(`excellentStipend = ${excellentStipend}`);
- isStpend = true;
- }
- if (isStpend === false) {
- console.log("You cannot get a scholarship!");
- } else {
- if (socialStipend > excellentStipend) {
- console.log(`You get a Social scholarship ${Math.floor(socialStipend)} BGN`);
- } else {
- console.log(`You get a scholarship for excellent results ${Math.floor(excellentStipend)} BGN`);
- }
- }
- }
- solve(["300.00", "5.65", "420.00"]) ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement