Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.48 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 ushort 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> Itali = new List<Store>();
  60.             //shoes            
  61.             Itali.Add(new Store("Itali", 10, 400, "Angel"));
  62.             Itali.Add(new Store("Itali", 11, 450, "Banini"));
  63.             Console.WriteLine();
  64.  
  65.             List<Store> France = new List<Store>();
  66.             France.Add(new Store("France", 20, 445, "Merci"));
  67.             France.Add(new Store("France", 21, 400, "Flamme"));
  68.  
  69.             Console.WriteLine("Choose a shoe model...\n\nFor Italian - press 1 \nFor French - press 2");
  70.  
  71.         there:
  72.             sbyte choice = Convert.ToSByte(Console.ReadLine());
  73.             while (true)
  74.             {
  75.                 if (choice == 1)
  76.                 {
  77.  
  78.                     foreach (Store italian in Itali)
  79.                     {
  80.                         italian.ShowInfoAboutModel();
  81.                     }
  82.                     Console.WriteLine("for buy select... y\n");
  83.                     char select = Convert.ToChar(Console.ReadLine());
  84.                
  85.                  if (select == 'y')
  86.                 {
  87.                     Console.WriteLine("Select id of shoe...");
  88.                     foreach (Store numberOfId in Itali)
  89.                     {
  90.                         Console.WriteLine(numberOfId.id);
  91.  
  92.                         //sbyte shoeSelect = Convert.ToSByte(Console.ReadLine());
  93.                         // Console.ReadLine();
  94.                     }
  95.                 }
  96.                     break;
  97.                 }
  98.                 else if (choice == 2)
  99.                 {
  100.  
  101.                     foreach (Store french in France)
  102.                     {
  103.                         french.ShowInfoAboutModel();
  104.                     }
  105.                 }
  106.                 if (choice != 1 & choice != 2)
  107.                 {
  108.                     Console.WriteLine("Select 1 or 2");
  109.                     Console.ReadKey();
  110.                     goto there;
  111.  
  112.                 }
  113.             }
  114.         }
  115.     }
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement