Advertisement
slawea

Untitled

Sep 15th, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.96 KB | None | 0 0
  1. class Products
  2. {
  3.      public List<string> ProductsInBag { get; set; }
  4.      public int NumberProductsInShop { get; set; }
  5.      public int NumberClientsInShop { get; set; }
  6.      public List<string> TypesProductsInBag { get; set; }
  7.      public int NumberOrders { get; set; }
  8.      public string FirstNameClient { get; set; }
  9.      public string LastNameClient { get; set; }
  10.      public string ZipCodeClient { get; set; }
  11.      public int NumberProductsInBag { get; set; }
  12.      public int NumberDrinksInBag { get; set; }
  13.      public int NumberCandysInBag { get; set; }
  14.      public double PriceAllProductsInBag { get; set; }
  15.  
  16.      public Products(int numberproductsinShop)
  17.      {
  18.          NumberProductsInShop = numberproductsinShop;
  19.      }
  20.  
  21.      public void IfClientWentToShop()
  22.      {
  23.          NumberClientsInShop += 1;
  24.      }
  25.  
  26.      public string AddProduct(double priceproduct, string product, string typeproduct)
  27.      {
  28.         ProductsInBag.Add(product);
  29.         if (TypesProductsInBag.Contains(typeproduct))
  30.         {
  31.             Console.WriteLine("Taki typ produktu już jest w koszyku!");
  32.         }
  33.         else
  34.         {
  35.             TypesProductsInBag.Add(typeproduct);
  36.         }
  37.  
  38.         if (typeproduct == "słodycze")
  39.         {
  40.             NumberCandysInBag += 1;
  41.         }
  42.         else if (typeproduct=="napój")
  43.         {
  44.             NumberDrinksInBag += 1;
  45.         }
  46.            
  47.         PriceAllProductsInBag += priceproduct;
  48.         return product;
  49.      }
  50.  
  51.      public string GiveOrders(string firstnameclient, string lastnameclient, string zipcodeclient)
  52.      {
  53.         NumberOrders += 1;
  54.         FirstNameClient = firstnameclient;
  55.         LastNameClient = lastnameclient;
  56.         ZipCodeClient = zipcodeclient;
  57.  
  58.         NumberProductsInBag = ProductsInBag.Count;
  59.  
  60.         return "Zamówienie złożone!";
  61.      }
  62.  
  63.      public double BuyProducts(double mywallet)
  64.      {
  65.         return mywallet - PriceAllProductsInBag;
  66.      }
  67.  
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement