Advertisement
Liliana797979

vqrno reshenie na flowers

Dec 8th, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function flowers(arg1, arg2, arg3, arg4, arg5) {
  2.     let magnoliasCount = Number(arg1);
  3.     let hyathinthusCount = Number(arg2);
  4.     let rosesCount = Number(arg3);
  5.     let cactiCount = Number(arg4);
  6.     let price = Number(arg5);
  7.  
  8.     let magnoliasPrice = magnoliasCount * 3.25;
  9.     let hyathinthusPrice = hyathinthusCount * 4;
  10.     let rosesPrice = rosesCount * 3.5;
  11.     let cactiPrice = cactiCount * 8;
  12.     let totalPrice = magnoliasPrice + hyathinthusPrice + rosesPrice + cactiPrice;
  13.     let taxes = totalPrice * 0.05;
  14.     let profit = totalPrice - taxes;
  15.     let money = 0;
  16.     let totalProfit = money - profit;
  17.  
  18.     if (profit>=price) {
  19.         console.log(`She is left with ${(Math.floor)(profit-price)} leva.`);
  20.  
  21.     } else {
  22.         console.log(`She will have to borrow ${(Math.abs)((Math.ceil)(price-profit))} leva.`);
  23.     }
  24. }
  25. flowers('2','3','5','1','50');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement