Advertisement
desislava_topuzakova

Coffee.cs

Jul 1st, 2023
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace RegularExam_UASD
  6. {
  7. internal class Coffee
  8. {
  9. //полета -> характеристики
  10. private string type;
  11. private double price;
  12.  
  13. //конструктори
  14. public Coffee ()
  15. {
  16. //нов празен обект
  17. //type = null
  18. //price = 0.0
  19. }
  20.  
  21. public Coffee (string type, double price)
  22. {
  23. //нов празен обект
  24. this.type = type;
  25. this.price = price;
  26. }
  27.  
  28. //getters and setters
  29. public string Type
  30. {
  31. get
  32. {
  33. return type;
  34. }
  35.  
  36. set
  37. {
  38. type = value;
  39. }
  40. }
  41.  
  42. public double Price
  43. {
  44. get
  45. {
  46. return price;
  47. }
  48. set
  49. {
  50. price = value;
  51. }
  52. }
  53.  
  54. public override string ToString()
  55. {
  56. return $"Coffee {Type} costs {Price:F2} lv.";
  57. }
  58.  
  59. }
  60. }
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement