Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Exam
- {
- class Program
- {
- static void Main(string[] args)
- {
- int howManyAtStart = int.Parse(Console.ReadLine());
- string cafe = "";
- double money = 0;
- while (true)
- {
- if (howManyAtStart <= 0)
- {
- Console.WriteLine("No more coffee left!");
- break;
- }
- cafe = Console.ReadLine();
- if (cafe == "closed")
- {
- Console.WriteLine($"Coffee left: {howManyAtStart}g");
- break;
- }
- switch (cafe)
- {
- case "espresso":
- if (howManyAtStart >= 50)
- {
- money += 3.00;
- howManyAtStart -= 50;
- }
- else
- {
- Console.WriteLine("Not enough coffee!");
- }
- break;
- case "cappuccino":
- if (howManyAtStart >= 30)
- {
- money += 3.50;
- howManyAtStart -= 30;
- }
- else
- {
- Console.WriteLine("Not enough coffee!");
- }
- break;
- case "latte":
- if (howManyAtStart >= 20)
- {
- money += 3.50;
- howManyAtStart -= 20;
- }
- else
- {
- Console.WriteLine("Not enough coffee!");
- }
- break;
- }
- }
- Console.WriteLine($"Profit: {money:F2} lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement