Advertisement
Ab_georgi

08. Scholarship JavaScript

Nov 19th, 2019
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(input) {
  2.     let doxod = Number(input.shift())
  3.     let uspeh = Number(input.shift())
  4.     let zaplata = Number(input.shift())
  5.     let stipendia = 0
  6.     let stipendiaUspeh = 0
  7.     if (doxod <= zaplata && uspeh >= 4.50) {
  8.         stipendia = (zaplata * 0.35)
  9.     }
  10.     if (uspeh >= 5.5) {
  11.      stipendiaUspeh = uspeh * 25
  12.    
  13.     }
  14.     if (stipendia < stipendiaUspeh) {
  15.         console.log (`You get a scholarship for excellent results ${stipendiaUspeh.toFixed(0)} BGN`)
  16.     }
  17.     else if (stipendiaUspeh < stipendia) {
  18.         console.log (`You get a Social scholarship ${stipendia.toFixed(0)} BGN`)
  19.     }
  20.     else {
  21.         console.log ("You cannot get a scholarship!")
  22.     }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement