Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Threading.Tasks;
- namespace Clight_33_QueueShop
- {
- class Program
- {
- static void Main(string[] args)
- {
- float cash = 1.75f;
- float cost;
- Random random = new Random();
- Queue<string> clients = new Queue<string>();
- clients.Enqueue("Роман");
- clients.Enqueue("Алексей");
- clients.Enqueue("Мария");
- clients.Enqueue("Вадим");
- clients.Enqueue("Анна");
- clients.Enqueue("Виталий");
- clients.Enqueue("Марина");
- clients.Enqueue("Сергей");
- clients.Enqueue("Владимир");
- clients.Enqueue("Евгения");
- while (clients.Count > 0)
- {
- cost = Convert.ToSingle(random.Next(90, 15001))/3;
- Console.Clear();
- Console.Write("Добро пожаловать за кассу нашего магазина.");
- Console.Write(" Касса: ");
- PrintRubFormat(cash);
- Console.Write($"Текущий клиент: {clients.Peek()}. Сумма покупки: ");
- PrintRubFormat(cost);
- Console.WriteLine("Следующие в очереди:");
- clients.Dequeue();
- foreach (string client in clients)
- {
- Console.WriteLine(client);
- }
- Console.WriteLine("\nНажмите любую клавишу, чтобы обслужить.\n\n");
- Console.ReadKey();
- cash += cost;
- }
- Console.Clear();
- Console.WriteLine($"Рабочий день закончен.\n");
- Console.Write($"Касса: ");
- PrintRubFormat(cash);
- }
- static void PrintRubFormat(float price)
- {
- Console.Write("{0:#.##}", price);
- Console.WriteLine(" руб.\n");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement