بدون توضیح

ebakhtin dba749aa1c commit 7 ماه پیش
Program.cs 03ed8a2611 commit 7 ماه پیش
readme.md dba749aa1c commit 7 ماه پیش
t6_oop1.csproj 03ed8a2611 commit 7 ماه پیش
t6_oop1.sln 03ed8a2611 commit 7 ماه پیش

readme.md

 Магазин Электроники

var client1 = new Client("Иван", "Березов", 21, "+79938287424");
var worker1 = new Worker("Анастасия", "Иванова", 32, 47000,"Менеджер");
var worker2 = new Worker("Глеб", "Олехин", 27, 23000,"Продавец");
var product1 = new Item("Iphone 13 Pro", 94999);
var smartpones = new Category("Смартфон");
product1.category = smartpones;
Console.WriteLine($"{worker2.firstName} продал покупателю {client1.firstName} {product1.category.title} {product1.title} за {product1.price} рублей ");
Console.WriteLine($"{worker1.position} {worker1.firstName} повысил зарпалту сотруднику {worker2.firstName} {worker2.lastName}.");

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

    public Category(string title)
    {
        this.title = title;
    }
}

public class Item
{
    public string title { get; set; }
    public Category category { get; set; }
    public string description { get; set; }
    public double price { get; set; }

    public Item (string title, double price)
    {
        this.title = title;
        this.price = price;
    }
}

public abstract class Person
{
    public string firstName { get; set; }
    public string lastName { get; set; }
    public int age { get; set; }

    public Person(string firstName, string lastName, int age)
    {
        this.firstName = firstName;
        this.lastName = lastName;
        this.age = age;
    }
}

public class Worker : Person
{
    public double salary { get; set; }
    public string position { get; set; }

    public Worker(string firstName, string lastName, int age, double salary, string position) : base(firstName, lastName, age)
    {
        this.salary = salary;
        this.position = position;
    }
}

public class Client : Person
{
    public string numberPhone { get; set; }
    
    public Client(string firstName, string lastName, int age, string numberPhone) : base(firstName, lastName, age)
    {
        this.numberPhone = numberPhone;
    }
}