Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace C
- {
- class Program
- {
- abstract class Plane
- {
- protected string brand;
- protected double speed;
- public abstract void input();
- public abstract void output();
- }
- class Destroyer : Plane
- {
- string status;
- public override void input()
- {
- Console.Write("Модель истребителя:");
- brand = Console.ReadLine();
- Console.Write("Его сокрость:");
- speed = Convert.ToDouble(Console.ReadLine());
- Console.Write("В каком состоянии:");
- status = Console.ReadLine();
- }
- public override void output()
- {
- Console.Write("Модель:{0}\nСкорость:{1} км/ч\nСостояние:{2}\n", brand, speed, status);
- }
- }
- class Passenger_liner : Plane
- {
- int count_people;
- public override void input()
- {
- Console.Write("Модель пассажирского транспорта:");
- brand = Console.ReadLine();
- Console.Write("Скорость транспорта:");
- speed = Convert.ToDouble(Console.ReadLine());
- Console.Write("Сколько пассажиров может поместиться:");
- count_people = Convert.ToInt32(Console.ReadLine());
- }
- public override void output()
- {
- Console.Write("Марка:{0}\nСкорость:{1} км/ч\nМаксимальное количество людей:{2} кол\n", brand, speed, count_people);
- }
- }
- static void Main(string[] args)
- {
- Plane d = new Destroyer();
- d.input();
- d.output();
- d = new Passenger_liner();
- d.input();
- d.output();
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment