Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp3
- {
- class Program
- {
- static void Main(string[] args)
- {
- Product[] product = { new Product(1,"Маска трехслойная", 900, 100), new Product(2, "Аппарат ИВЛ",20000, 2), new Product(3, "Гречка", 150, 10), new Product(4, "Туалетная бумага", 200, 20) };
- Player player = new Player(100000, "");
- Seller seller = new Seller(0, "");
- while (true)
- {
- Console.WriteLine("Добро пожаловать в магазин!");
- Console.WriteLine();
- Console.WriteLine("У Вас в кошельке есть - "+ player.Coins + " рублей.");
- Console.WriteLine();
- Console.WriteLine("/nВеедите 'товары' чтобы посмотреть ассортимет магазина./nВведите 'пакет', что бы посмотреть покупки.");
- string command = Console.ReadLine();
- switch (command)
- {
- case "1":
- break;
- case "2":
- break;
- case "3":
- break;
- case "4":
- break;
- case "пакет":
- player.MyBag();
- break;
- case "товары":
- Console.WriteLine("У нас Вы можете купить:");
- Console.WriteLine();
- for (int i = 0; i < product.Length; i++)
- {
- product[i].ShowProduct();
- }
- Console.WriteLine();
- Console.WriteLine("Введите номер товара, который Вы хотели бы приобрести.");
- Console.WriteLine("Поторопитесь, количество товара ограничено!");
- break;
- }
- Console.ReadKey();
- }
- }
- }
- class Player
- {
- public int Coins;
- public string[] Inventory;
- public Player(int coins, string[] inventory)
- {
- Coins = coins;
- Inventory = inventory;
- }
- public void MyBag()
- {
- Console.WriteLine(Inventory);
- }
- }
- class Seller
- {
- public int Coins;
- public string[] Inventory;
- public Seller(int coins, string[] inventory)
- {
- Coins = coins;
- Inventory = inventory;
- }
- }
- class Product
- {
- public int Number;
- public string ProductName;
- public int ProductCost;
- public int ProductQuantity;
- public Product(int number, string productName, int productCost, int productQuantity)
- {
- Number = number;
- ProductName = productName;
- ProductCost = productCost;
- ProductQuantity = productQuantity;
- }
- public void ShowProduct()
- {
- Console.WriteLine($"{Number}. {ProductName} по цене - {ProductCost} рублей");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement