Advertisement
Prodanoff

toyshopwqrna

Feb 16th, 2020
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function toyshop(input)
  2. {
  3.     let vacation = Number(input.shift());
  4.     let puzels = Number(input.shift());
  5.     let dols = Number(input.shift());
  6.     let teddybears = Number(input.shift());
  7.     let minions = Number(input.shift());
  8.     let trucks = Number(input.shift());
  9.     let number = puzels+dols+teddybears+minions+trucks;
  10.     let puzelsprice = 2.6 ;
  11.     let dolsprice = 3 ;
  12.     let teddybearsprice = 4.1 ;
  13.     let minionsprice = 8.2 ;
  14.     let trucksprice = 2 ;
  15.     let bigprice= puzels*puzelsprice+dols*dolsprice+teddybears*teddybearsprice+minions*minionsprice+trucks*trucksprice;
  16.     let bigpriceplus50 = (bigprice - (bigprice*0.25));
  17.     let finalpricenaem = (bigprice - (bigprice*0.1));
  18.     let finalpriceplus50 = (bigpriceplus50-(bigpriceplus50*0.1));
  19.     if (number>=50)
  20.     {
  21.         if (finalpriceplus50>=vacation)
  22.         {
  23.             let a = (finalpriceplus50 - vacation).toFixed(2);
  24.             console.log( `Yes! ${a} lv left.`)
  25.         }
  26.         else
  27.         {
  28.             let a = (vacation- finalpriceplus50).toFixed(2);
  29.             console.log(`Not enough money! ${a} lv needed.`);
  30.         }
  31.     }
  32.         else
  33.     {
  34.         if (finalpricenaem>=vacation)
  35.         {
  36.             let a = (finalpricenaem - vacation).toFixed(2);
  37.             console.log(`Yes! ${a} lv left.`)
  38.         }
  39.         else
  40.         {
  41.             let a = (vacation- finalpricenaem).toFixed(2);
  42.             console.log(`Not enough money! ${a} lv needed.`);
  43.         }
  44.     }
  45.  
  46.    
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement