Advertisement
Spocoman

Bracelet Stand

Jan 4th, 2022 (edited)
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function braceletStand(input) {
  2.     let dayCash = Number(input[0]) * 5;
  3.     let dayProfit = Number(input[1]) * 5;
  4.     let cost = Number(input[2]);
  5.     let giftPrice = Number(input[3]);
  6.     let total = dayCash + dayProfit - cost;
  7.  
  8.     if(total >= giftPrice){
  9.         console.log(`Profit: ${total.toFixed(2)} BGN, the gift has been purchased.`)
  10.     } else{
  11.         console.log(`Insufficient money: ${(giftPrice - total).toFixed(2)} BGN.`)
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement