Untitled

mail@pastecode.io avatar
unknown
csharp
a month ago
3.7 kB
0
Indexable
Never
public class Program
{

    private static void Main(string[] args)
    {

        Market market = new Market(
            "Nur",
            new Product[]
            {
             new Product(
                 "Qymyz",
                 "Drink",
                 new Gabaryte(2f,3f,4f),
                 new Person("Almat","Nur",
                    new Location("Qazaqstan","Atyrau", "Satpayev","2A")),
                 new Person("Shynggys","Seitekov",
                    new Location("Qazastan", "Atyrau", "Zhumagaliyeva","15R")),
                 4,
                 10),
            new Product(
                 "Et",
                 "Food",
                 new Gabaryte(1f,2f,3f),
                 new Person("Shynggys","Seitekov",
                    new Location("Qazaqstan","Almaty", "Al-Farabi","20C")),
                 new Person("Almat","Nur",
                    new Location("Qazastan", "Atyrau", "Samal","12A")),
                 4,
                 10)

            },

            new Location("Qazaqstan", "Atyrau", "Beibarys", "14d"));

        int select;

        Console.WriteLine($"1. {market.Name}");
        select = Convert.ToInt32(Console.ReadLine());

        if (select == 1)
        {
            Console.WriteLine("Please see the list of the products in the Market");
            for (int i = 0; i < market.Products.Length; i++)
            {
                Console.WriteLine($"{i + 1}. {market.Products[i].Name}");
            }
            Console.WriteLine("Please select which parametr of the product you want to see");
        }
        else
        {
            Console.WriteLine("Selected market does not exist");
        }
    }
}

class Product
{
    public string? Name;
    public string? Description;
    public Gabaryte Gabaryte;
    public Person? Seller;
    public Person? Buyer;
    public int Rating;
    public int Price;

    public Product(
        string? name,
        string? description,
          Gabaryte gabaryte,
        Person? seller,
        Person? buyer,
        int rating,
        int price)

    {
        Name = name;
        Description = description;
        Seller = seller;
        Buyer = buyer;
        Rating = rating;
        Price = price;
        Gabaryte = gabaryte;
    }
}

class Person
{
    public string FirstName;
    public string LastName;
    public Location Location;

    public Person(string firstName, string lastName, Location location)
    {
        FirstName = firstName;
        LastName = lastName;
        Location = location;
    }
}

class Market
{
    public string? Name;
    public Product[]? Products;
    public Location Location;

    public Market(string? name, Product[]? products, Location location)
    {
        Name = name;
        Products = products;
        Location = location;
    }
}

class Location
{
    public string Country;
    public string City;
    public string Street;
    public string Building;

    public Location(string country, string city, string street, string building)
    {
        Country = country;
        City = city;
        Street = street;
        Building = building;
    }
}

class Package
{
    public Size? Size;
    public float Price;
    public Gabaryte Gabaryte;
}

enum Size
{
    None,
    S,
    M,
    L,
    XL
}
class Gabaryte
{
    public float Length;
    public float Height;
    public float Width;

    public Gabaryte(float length, float height, float width)
    {
        Length = length;
        Height = height;
        Width = width;
    }
}

Leave a Comment