Advertisement
Guest User

Club

a guest
Jul 7th, 2019
1,179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. function solve(input){
  2.  
  3. let jelanaPechalba= input.shift()
  4. let sumPrice=0
  5. let command=input.shift()
  6. while(command!=`Party!`){
  7. let nameCoctail=command
  8. let brouCoctails=Number(input.shift())
  9. let price=(nameCoctail.length)
  10. let sum=price*brouCoctails
  11. if(sum%2!=0){
  12. sum=sum-(sum*0.25)
  13. }else{
  14.  
  15. }
  16. sumPrice+=sum
  17.  
  18. command=input.shift()
  19. }
  20.  
  21. if(command==`Party!`){
  22.  
  23. console.log(`We need ${(jelanaPechalba-sumPrice).toFixed(2)} leva more.`)
  24. } else if(sumPrice>=jelanaPechalba){
  25. console.log(`Target acquired.`)
  26. }
  27. console.log(`Club income - ${sumPrice.toFixed(2)} leva.`)
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement