Advertisement
Guest User

Coffe maker

a guest
Mar 29th, 2020
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. Task 3. Coffee maker
  2.  
  3. Write software to calculate the bill of a customer who has purchased a certain amount of coffee from a coffee machine. You must take into account the following discounts:
  4. • For a selected drink without sugar 35% discount.
  5. • Espresso and purchased at least 5 pieces, there is a 25% discount.
  6. • If the amount exceeds BGN 15, 20% discount from the final price, the discounts are applied in the order of their description.
  7.  
  8. >>The price should be formatted to the second decimal digit.
  9.  
  10. The input consists of three rows:
  11. • First line-drink-text with "Espresso", "Cappuccino" or "Tea" options
  12. • Second line-sugar-text with "Without", "Normal" or "Extra" options
  13. • Third line number of beverages-integer in the range [1 ... 50]
  14.  
  15. The console should print only: "You bought {number of beverages} cupsof {beverage} for {final price} lv."
  16.  
  17. Input:
  18. Espresso
  19. Without
  20. 10
  21.  
  22. Output:
  23. You bought 10 cups of Espresso for 4.39 lv.
  24.  
  25. Explanations:
  26. 10 pieces of Espresso without sugar 0.90 BGN for a glass -> 9 BGN 35% discount for a drink without sugar from 9 BGN -> 3.15-> 9 –3.15 = 5.8525% discount and to buy at least 5 espressos. 25% of 5.85 -> 1.46255.85 –1.4625 -> 4.3875
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement