using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class ResidenceType { static void Main(string[] args) { Residence[] houses = new Residence[] { new Residence(5, 5, 10, 125000000, "Особняк", 1, 1) }; foreach (Residence house in houses) Console.WriteLine(house.ToString()); Console.ReadKey(); } } class Residence { public int porchCount; public int floorCount; private int roomsOnFloor; private double meterCost; public string type; public int garage; public int garden; public int Porchs { get { return porchCount; } set { porchCount = value; } } public int Floors { get { return floorCount; } set { floorCount = value; } } public int RoomsOnFloor { get { return roomsOnFloor; } set { roomsOnFloor = value; } } public double Cost { get { return meterCost; } set { meterCost = value; } } public string Type { get { return type; } set { type = value; } } public int Garage { get { return garage; } set { garage = value; } } public int Garden { get { return garden; } set { garden = value; } } public Residence() { } public Residence(int porchCount, int floorCount, int roomsOnFloor, double cost, string type, int garage, int garden) { this.porchCount = porchCount; this.floorCount = floorCount; this.roomsOnFloor = roomsOnFloor; this.meterCost = cost; this.type = type; this.garage = garage; this.garden = garden; } public int GetRoomsCountInPorch() { return roomsOnFloor * floorCount; } public int GetRoomsCountInHouse() { return GetRoomsCountInPorch() * porchCount; } public double HouseCost() { return (double)GetRoomsCountInHouse() * Cost; } public double TheCostOfMaintainingTheGarden() { return (double)Garden; } public override string ToString() { return string.Format("Количество этажей: {0} \nКоличество подъездов: {1} \nКоличество комнат: {2} \nЖилье куплено за: {3} \nТип жилья: {4} \nГараж: {5} \nСад: {6} \nСтоимость жилья: {7} \nЗатраты на содержание сада: {8} ", Floors, Porchs, RoomsOnFloor, Cost, Type, Garage, Garden, HouseCost(), TheCostOfMaintainingTheGarden()); } } }