Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Task 3. Coffee maker
- 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:
- • For a selected drink without sugar 35% discount.
- • Espresso and purchased at least 5 pieces, there is a 25% discount.
- • If the amount exceeds BGN 15, 20% discount from the final price, the discounts are applied in the order of their description.
- >>The price should be formatted to the second decimal digit.
- The input consists of three rows:
- • First line-drink-text with "Espresso", "Cappuccino" or "Tea" options
- • Second line-sugar-text with "Without", "Normal" or "Extra" options
- • Third line number of beverages-integer in the range [1 ... 50]
- The console should print only: "You bought {number of beverages} cupsof {beverage} for {final price} lv."
- Input:
- Espresso
- Without
- 10
- Output:
- You bought 10 cups of Espresso for 4.39 lv.
- Explanations:
- 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