Bakhtina Sofya df162406b0 2nd commit | 8 bulan lalu | |
---|---|---|
ConsoleApp2 | 8 bulan lalu | |
.gitignore.txt | 8 bulan lalu | |
README.md | 8 bulan lalu |
Тема "Турагентство"
using System.Reflection;
class Category
{
public string title { get; set; }
public Category(string Title)
{
title = Title;
}
public void Display()
{
Console.WriteLine($"Это путешествие {title}");
}
}
class Place
{
public string Name { get; set; }
public int Price { get; set; }
public Category category { get; set; }
public Place(string name, int price)
{
Name = name;
Price = price;
}
public void Display()
{
Console.WriteLine($"{Name} - ${Price}");
}
}
class Client
{
public string Name { get; set; }
public Client (string name)
{
Name=name;
}
public void Order(List<Place> places)
{
Console.WriteLine($"{Name} выбрал путешествие в: ");
foreach (var place in places)
{
place.Display();
}
}
}
class Program
{
static void Main(string[] args)
{
Place place1 = new Place("Крым", 50000);
Place place2 = new Place("Сочи", 36000);
Place place3 = new Place("Самара", 25000);
Place place4 = new Place("Санкт-Петербург", 20000);
Place place5 = new Place("Мальдивы", 140000);
Client client1 = new Client("Маша");
Client client2 = new Client("Паша");
Client client3 = new Client("Леша");
Client client4 = new Client("Катя");
Category category1 = new ("по России" );
Category category2 = new ("за границей" );
List<Place> places = new List<Place> { place2 };
client3.Order(places);
category1.Display();
}
}
Леша выбрал путешествие в:
Сочи - $36000
Это путешествие по России