Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace trewreghgfdsfgf
- {
- class Program
- {
- abstract class MusicalInstruments
- {
- public MusicalInstruments()
- {
- }
- public virtual void Print() { }
- }
- class Spiritual : MusicalInstruments//Духовные
- {
- string Name;
- double Cost;
- string Color;
- public Spiritual(string name, double cost, string color)
- {
- this.Name = name;
- this.Cost = cost;
- this.Color = color;
- }
- public override void Print()
- {
- Console.WriteLine("Привет. Я " + Name + ". Стоимость: " + Cost + ". Цвет: " + Color);
- }
- }
- abstract class Strings : MusicalInstruments//Струнные
- {
- public abstract void Output();
- }
- class Drums : MusicalInstruments//Ударные
- {
- string Name;
- double Cost;
- string Color;
- public Drums(string name, double cost, string color)
- {
- this.Name = name;
- this.Cost = cost;
- this.Color = color;
- }
- public override void Print()
- {
- Console.WriteLine(Name + " " + Cost + " " + Color);
- }
- }
- class Plucked : Strings//Щипковые
- {
- string Name;
- double Cost;
- string Color;
- public Plucked(string name, double cost, string color)
- {
- this.Name = name;
- this.Cost = cost;
- this.Color = color;
- }
- public override void Output()
- {
- Console.WriteLine("Щипковый инструмент: " + Name + " Цена: " + Cost + " Цвет: " + Color);
- }
- }
- class Bowed : Strings//Смычковые
- {
- string Name;
- double Cost;
- string Color;
- public Bowed(string name, double cost, string color)
- {
- this.Name = name;
- this.Cost = cost;
- this.Color = color;
- }
- public override void Output()
- {
- Console.WriteLine("Смычковый инструмент: " + Name + " Цена: " + Cost + " Цвет: " + Color);
- }
- }
- static void Main(string[] args)
- {
- List<Spiritual> spiritual = new List<Spiritual>();
- List<Drums> drams = new List<Drums>();
- List<Bowed> bowed = new List<Bowed>();
- List<Plucked> plucked = new List<Plucked>();
- Spiritual Yamaha_YRS23 = new Spiritual("Флейта",18.92, "Белый");
- spiritual.Add(Yamaha_YRS23);
- Spiritual MTP_BB2000S = new Spiritual("Кларнет", 176.20, "Черный");
- spiritual.Add(MTP_BB2000S);
- Drums Yamaha_DTX402K = new Drums("Барабан", 1518, "Черный");
- drams.Add(Yamaha_DTX402K);
- Bowed CervinHV100 = new Bowed("Скрипка", 207.90, "Черный");
- bowed.Add(CervinHV100);
- Bowed CerviniHC100 = new Bowed("Виолончель", 805.19, "Белый");
- bowed.Add(CerviniHC100);
- Plucked SX_LG1 = new Plucked("Гитара", 207.30, "Черный");
- plucked.Add(SX_LG1);
- Plucked B61 = new Plucked("Балалайка", 100, "Белый");
- plucked.Add(B61);
- foreach (var v in spiritual)
- {
- v.Print();
- }
- Console.WriteLine();
- foreach (var v in drams)
- {
- v.Print();
- }
- Console.WriteLine();
- foreach (var v in bowed)
- {
- v.Output();
- }
- Console.WriteLine();
- foreach (var v in plucked)
- {
- v.Output();
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement