Žiadny popis

sbakhtina 95a2541dbf Обновить 'README.md' 7 mesiacov pred
ClassLibrary1 81dbc0532c 1st commit 7 mesiacov pred
ConsoleApp3 81dbc0532c 1st commit 7 mesiacov pred
.gitignore.txt 4b0a6ae650 1st commit 8 mesiacov pred
README.md 95a2541dbf Обновить 'README.md' 7 mesiacov pred

README.md

Program.cs

using ClassLibrary1;
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();
    }
}

Person.cs

namespace ClassLibrary1;

using System.Reflection;

public class Category
{
    public string title { get; set; }

    public Category(string Title)
    {
        title = Title;
    }
    public void Display()
    {
        Console.WriteLine($"Это путешествие {title}");
    }
}
public 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}");
    }
}
public 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();
        }
    }

}

Вывод

Леша выбрал путешествие в: 
Сочи - $36000            
Это путешествие по России