Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CoffeeMachine
- {
- class Program
- {
- static void Main(string[] args)
- {
- string coffee = Console.ReadLine();
- string sugar = Console.ReadLine();
- int volume = int.Parse(Console.ReadLine());
- double sum = 0;
- switch (coffee)
- {
- case "Espresso":
- if (sugar == "Without")
- {
- sum = volume * 0.9;
- sum *= 0.65;
- }
- else if (sugar == "Normal")
- {
- sum = volume;
- }
- else if (sugar == "Extra")
- {
- sum = volume * 1.2;
- }
- if (volume > 5)
- {
- sum *= 0.75;
- }
- break;
- case "Cappuccino":
- if (sugar == "Without")
- {
- sum = volume;
- sum *= 0.65;
- }
- else if (sugar == "Normal")
- {
- sum = volume * 1.2;
- }
- else if (sugar == "Extra")
- {
- sum = volume * 1.6;
- }
- break;
- case "Tea":
- if (sugar == "Without")
- {
- sum = volume * 0.5;
- sum *= 0.65;
- }
- else if (sugar == "Normal")
- {
- sum = volume * 0.6;
- }
- else if (sugar == "Extra")
- {
- sum = volume * 0.7;
- }
- break;
- }
- if (sum > 15)
- {
- sum *= 0.8;
- }
- Console.WriteLine($"You bought {volume} cups of {coffee} for {sum:F2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement