Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.35 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 trewreghgfdsfgf
  8. {
  9. class Program
  10. {
  11.  
  12. abstract class MusicalInstruments
  13. {
  14. public MusicalInstruments()
  15. {
  16.  
  17. }
  18.  
  19. public virtual void Print() { }
  20.  
  21. }
  22.  
  23. class Spiritual : MusicalInstruments//Духовные
  24. {
  25.  
  26. string Name;
  27. double Cost;
  28. string Color;
  29.  
  30. public Spiritual(string name, double cost, string color)
  31. {
  32. this.Name = name;
  33. this.Cost = cost;
  34. this.Color = color;
  35. }
  36.  
  37. public override void Print()
  38. {
  39. Console.WriteLine("Привет. Я " + Name + ". Стоимость: " + Cost + ". Цвет: " + Color);
  40. }
  41. }
  42.  
  43. abstract class Strings : MusicalInstruments//Струнные
  44. {
  45. public abstract void Output();
  46. }
  47.  
  48. class Drums : MusicalInstruments//Ударные
  49. {
  50.  
  51. string Name;
  52. double Cost;
  53. string Color;
  54.  
  55. public Drums(string name, double cost, string color)
  56. {
  57. this.Name = name;
  58. this.Cost = cost;
  59. this.Color = color;
  60. }
  61.  
  62. public override void Print()
  63. {
  64. Console.WriteLine(Name + " " + Cost + " " + Color);
  65. }
  66. }
  67.  
  68. class Plucked : Strings//Щипковые
  69. {
  70.  
  71. string Name;
  72. double Cost;
  73. string Color;
  74.  
  75. public Plucked(string name, double cost, string color)
  76. {
  77. this.Name = name;
  78. this.Cost = cost;
  79. this.Color = color;
  80. }
  81.  
  82. public override void Output()
  83. {
  84. Console.WriteLine("Щипковый инструмент: " + Name + " Цена: " + Cost + " Цвет: " + Color);
  85. }
  86. }
  87.  
  88. class Bowed : Strings//Смычковые
  89. {
  90. string Name;
  91. double Cost;
  92. string Color;
  93.  
  94. public Bowed(string name, double cost, string color)
  95. {
  96. this.Name = name;
  97. this.Cost = cost;
  98. this.Color = color;
  99. }
  100.  
  101. public override void Output()
  102. {
  103. Console.WriteLine("Смычковый инструмент: " + Name + " Цена: " + Cost + " Цвет: " + Color);
  104. }
  105. }
  106. static void Main(string[] args)
  107. {
  108. List<Spiritual> spiritual = new List<Spiritual>();
  109. List<Drums> drams = new List<Drums>();
  110. List<Bowed> bowed = new List<Bowed>();
  111. List<Plucked> plucked = new List<Plucked>();
  112.  
  113. Spiritual Yamaha_YRS23 = new Spiritual("Флейта",18.92, "Белый");
  114. spiritual.Add(Yamaha_YRS23);
  115.  
  116. Spiritual MTP_BB2000S = new Spiritual("Кларнет", 176.20, "Черный");
  117. spiritual.Add(MTP_BB2000S);
  118.  
  119. Drums Yamaha_DTX402K = new Drums("Барабан", 1518, "Черный");
  120. drams.Add(Yamaha_DTX402K);
  121.  
  122. Bowed CervinHV100 = new Bowed("Скрипка", 207.90, "Черный");
  123. bowed.Add(CervinHV100);
  124.  
  125. Bowed CerviniHC100 = new Bowed("Виолончель", 805.19, "Белый");
  126. bowed.Add(CerviniHC100);
  127.  
  128. Plucked SX_LG1 = new Plucked("Гитара", 207.30, "Черный");
  129. plucked.Add(SX_LG1);
  130.  
  131. Plucked B61 = new Plucked("Балалайка", 100, "Белый");
  132. plucked.Add(B61);
  133.  
  134. foreach (var v in spiritual)
  135. {
  136. v.Print();
  137. }
  138. Console.WriteLine();
  139.  
  140. foreach (var v in drams)
  141. {
  142. v.Print();
  143. }
  144. Console.WriteLine();
  145.  
  146. foreach (var v in bowed)
  147. {
  148. v.Output();
  149. }
  150. Console.WriteLine();
  151.  
  152. foreach (var v in plucked)
  153. {
  154. v.Output();
  155. }
  156. Console.ReadLine();
  157. }
  158. }
  159. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement