Advertisement
desislava_topuzakova

Animal

Jun 30th, 2024
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace AlgorithmsRegularExam
  6. {
  7. public class Animal
  8. {
  9.  
  10. private string type;
  11. private int weight;
  12.  
  13. public Animal()
  14. {
  15.  
  16. }
  17.  
  18. public Animal(string type, int weight)
  19. {
  20. Type = type;
  21. Weight = weight;
  22. }
  23.  
  24. public string Type
  25. {
  26. get
  27. {
  28. return type;
  29. }
  30. set
  31. {
  32. type = value;
  33. }
  34. }
  35. public int Weight
  36. {
  37. get
  38. {
  39. return weight;
  40. }
  41. set
  42. {
  43. weight = value;
  44. }
  45. }
  46.  
  47. public override string ToString()
  48. {
  49. return $"Animal {Type} weights {Weight} kg.";
  50. }
  51.  
  52. }
  53. }
  54.  
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement