Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace shop
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- Cashbox cashbox = new Cashbox();
- while (true)
- {
- Console.ReadKey();
- }
- }
- }
- class Cashbox
- {
- Queue<Client> clients = new Queue<Client>();
- public void AddClient()
- {
- clients.Enqueue();
- }
- public void ShowInfo()
- {
- for (int i = 0; i < clients.Count; i++)
- {
- Console.WriteLine(clients.Peek());
- }
- }
- }
- class Client
- {
- public int Money { get; private set; }
- Basket basket = new Basket();
- Random random = new Random();
- public Client()
- {
- int money = random.Next(1000, 15000);
- Money = money;
- basket = new Basket();
- }
- }
- class Basket
- {
- List<Product> basket = new List<Product>();
- public Basket()
- {
- PutProducts();
- }
- private void PutProducts()
- {
- Random random = new Random();
- int products = random.Next(0, 10);
- for (int i = 0; i < products; i++)
- {
- basket.Add(new Product());
- }
- }
- }
- class Product
- {
- public int Price { get; private set; }
- Random random = new Random();
- public Product()
- {
- int price = random.Next(1, 1000);
- Price = price;
- }
- }
- }
Add Comment
Please, Sign In to add comment