Advertisement
Guest User

Untitled

a guest
Feb 24th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication11
  8. {
  9.     class Store
  10.     {
  11.         public static int count = 0;
  12.         public string country;
  13.         public int id;
  14.         public ushort price;
  15.         public string name;
  16.  
  17.         public string userName;
  18.         public ushort userMoney;
  19.  
  20.         public Store(string userName, ushort userMoney)
  21.         {
  22.             this.userName = userName;
  23.             this.userMoney = userMoney;
  24.         }
  25.         public Store(string country, ushort id, ushort price, string name)
  26.         {
  27.             this.country = country;
  28.             this.id = id;
  29.             this.price = price;
  30.             this.name = name;
  31.  
  32.         }
  33.         public void idOfshoes()
  34.         {
  35.             Console.WriteLine("Id: " + id);
  36.         }
  37.         public void ShowUserInfo()
  38.         {
  39.             Console.WriteLine("Profile: " + userName + "\nTotal money: " + userMoney + '$');
  40.         }
  41.         public void ShowInfoAboutModel()
  42.         {
  43.             Console.WriteLine("County: " + country + "\nId: " + id + "\nPrice: " + price + '$' + "\nName: " + name + "\n");
  44.         }
  45.     }
  46.  
  47.     class Goods
  48.     {
  49.         static void Main(string[] args)
  50.         {
  51.             List<Store> AllUsers = new List<Store>();
  52.             //user            
  53.             AllUsers.Add(new Store("Alex", 500));
  54.             foreach (Store user in AllUsers)
  55.             {
  56.                 user.ShowUserInfo();
  57.             }
  58.  
  59.             List<Store> Shoes = new List<Store>();
  60.             //shoes            
  61.             Shoes.Add(new Store("Itali", 10, 300, "Angel"));
  62.             Shoes.Add(new Store("Itali", 11, 445, "Banini"));
  63.             Console.WriteLine();
  64.  
  65.             Console.WriteLine("For select a model - press 1");
  66.         there:
  67.             sbyte choice = Convert.ToSByte(Console.ReadLine());
  68.             while (true)
  69.             {
  70.                 if (choice == 1)
  71.                 {
  72.                     foreach (Store italian in Shoes)
  73.                     {
  74.                         italian.ShowInfoAboutModel();
  75.                     }
  76.                     Console.WriteLine("for buy select... y\n");
  77.                     char select = Convert.ToChar(Console.ReadLine());
  78.  
  79.                     if (select == 'y')
  80.                     {
  81.                         Console.WriteLine("Select item id for buy...");
  82.                         foreach (Store numberOfId in Shoes)
  83.                         {
  84.                             int summ;
  85.                             int shoeSelect = Convert.ToInt32(Console.ReadLine());
  86.                             numberOfId.id = shoeSelect;
  87.                             //Shoes.ElementAt();
  88.  
  89.                              //numberOfId.id = numberOfId.price;
  90.  
  91.                            // foreach (Store userName in AllUsers)
  92.                             //{
  93.                             //  summ = userName.userMoney - numberOfId.id;
  94.  
  95.                            //   Console.WriteLine("\nThe buy was successfully completed.\n\nAccount balance: " + summ + '$');
  96.                             // Console.ReadKey();
  97.  
  98.                            //   }
  99.                         }
  100.                     }
  101.                     break;
  102.                 }
  103.                 if (choice != 1 & choice != 2)
  104.                 {
  105.                     Console.WriteLine("Select 1 or 2");
  106.                     Console.ReadKey();
  107.                     goto there;
  108.  
  109.                 }
  110.             }
  111.         }
  112.     }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement