Advertisement
slawea

Untitled

Sep 17th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 KB | None | 0 0
  1. interface IQuantityKilo
  2. {
  3.     void DisplayQuantityKilo();
  4. }
  5. interface IQuantityLiter
  6. {
  7.     void DisplayQuantityLiter();
  8. }
  9.  
  10. abstract class TypeProductsInBag
  11. {
  12.     public abstract void CalculateTypeProductsInBag(int quantity);
  13. }
  14.  
  15. class FruitsInBag:TypeProductsInBag, IQuantityKilo
  16. {
  17.     public int NumberFruitInBag { get; set; }
  18.  
  19.     public override void CalculateTypeProductsInBag(int quantity)
  20.     {
  21.         NumberFruitInBag += quantity;
  22.     }
  23.  
  24.     public void DisplayQuantityKilo()
  25.     {
  26.         //wyświetl ilość kilogramów
  27.     }
  28. }
  29.  
  30. class DrinksInBag : TypeProductsInBag, IQuantityLiter
  31. {
  32.     public int NumberDrinksInBag { get; set; }
  33.  
  34.     public override void CalculateTypeProductsInBag(int quantity)
  35.     {
  36.         NumberDrinksInBag += quantity;
  37.     }
  38.  
  39.     public void DisplayQuantityLiter()
  40.     {
  41.         //wyświetl ilość litrów
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement