jgrebnev 23642c4398 t6_oop1 | 8 ヶ月 前 | |
---|---|---|
.gitignore.txt | 9 ヶ月 前 | |
readme.md | 8 ヶ月 前 |
Предметная область:
using System;
class product
{
public string Name { get; set; }
public int Price { get; set; }
public product(string name, int price)
{
Name = name;
Price = price;
}
public void Display()
{
Console.WriteLine($"{Name} - ${Price}");
}
}
class salesmans
{
public string Name { get; set; }
public salesmans(string name)
{
Name = name;
}
public void Order(List<product> products)
{
Console.WriteLine($"{Name} Продает: ");
foreach (var product in products)
{
product.Display();
}
}
}
class Program
{
static void Main(string[] args)
{
product product1 = new product("Поршень", 495);
product product2 = new product("ЦПГ", 11000);
product product3 = new product("Шины", 320);
product product4 = new product("Автомобильная эмаль", 690);
product product5 = new product("Вонючка", price:80);
salesmans meat1 = new salesmans("Артем Леухин");
salesmans meat2 = new salesmans("Кирилл Цыганович");
salesmans meat3 = new salesmans("Ярик Мегадез");
salesmans meat4= new salesmans("Тайлер Дырдыр");
List<product> places = new List<product> { product2, product5 };
meat1.Order(places);
}
}
Артем Леухин Продает:
ЦПГ - $11000
Вонючка - $80