Advertisement
Liliana797979

fishing boat viarno reshenie

Jan 30th, 2021
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.      
  2. function demo(input) {
  3.     let budget = Number(input[0])
  4.     let season = input[1]
  5.     let people = Number(input[2])
  6.  
  7.     let total = 0;
  8.  
  9.     if(season == "Spring"){
  10.         if(people <= 6){
  11.             total = 3000 * 0.90
  12.         }
  13.         else if(people > 6 && people <= 11){
  14.             total = 3000 * 0.85
  15.         }
  16.         else{
  17.             total = 3000 * 0.75
  18.         }
  19.     }
  20.     else if( season == "Summer" || season == "Autumn"){
  21.         if(people <= 6){
  22.             total = 4200 * 0.90
  23.         }
  24.         else if(people > 6 && people <= 11){
  25.             total = 4200 * 0.85
  26.         }
  27.         else{
  28.             total = 4200 * 0.75
  29.         }
  30.     }
  31.     else if( season == "Winter"){
  32.         if(people <= 6){
  33.             total = 2600 * 0.90
  34.         }
  35.         else if(people > 6 && people <= 11){
  36.             total = 2600 * 0.85
  37.         }
  38.         else{
  39.             total = 2600 * 0.75
  40.         }
  41.     }
  42.     if( season !== "Autumn"){
  43.         if(people % 2 == 0){
  44.             total = total * 0.95
  45.         }
  46.     }
  47.     let moneyLeft = budget - total;
  48.     if(moneyLeft >= 0){
  49.         console.log(`Yes! You have ${moneyLeft.toFixed(2)} leva left.`);
  50.     }
  51.     else {
  52.         console.log(`Not enough money! You need ${(moneyLeft * -1).toFixed(2)} leva.`);
  53.     }
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement