Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- public class Building
- {
- /*
- /// <summary>
- /// //// poleta
- /// </summary>
- private string address;
- private int floors;
- private double kvadratniMetra;
- /// <summary>
- /// ///////////
- /// </summary>
- /// ///////////// property e kogato imame get i set
- public string Addres
- {
- get
- {
- return this.address;
- }
- set
- {
- this.address = value;
- }
- }
- /// <summary>
- /// /////////////////////////////////
- /// </summary>
- public int Floors
- {
- get
- {
- return this.floors;
- }
- }
- /// <summary>
- /// ////////////////////////////////
- /// </summary>
- public double KvadratniMetra
- {
- get
- {
- return this.kvadratniMetra;
- }
- }
- */
- private string address;
- public string Address
- {
- get
- {
- return this.address;
- }
- set
- {
- if (String.IsNullOrEmpty(value))
- {
- throw new ArgumentException("address cannot be empty.");// ne moje da s e sloji prazen adres
- }
- this.address = value;
- }
- }
- public int Floors { get; private set; }
- public double KvadtratniM { get; private set; }
- public readonly double Length;
- public const double PI = 3.1415926;
- /// <summary>
- /// /////// konstruktor
- /// </summary>
- /// <param name="address"></param>
- /// <param name="floors"></param>
- /// <param name="kvadratniMetra"></param>
- ///
- public Building(string address, int floors, double kvadratniMetra)
- {
- this.Address = address;
- this.Floors = floors;
- this.KvadtratniM = kvadratniMetra;
- this.Length = this.Floors * this.KvadtratniM;
- }
- /// <summary>
- /// //// drug konstruktor
- /// </summary>
- /// <param name="address"></param>
- ///
- public Building(string address) : this(address, 0, 0.0)
- {
- }
- /* public Building(string address)
- {
- this.Address = address;
- this.Floors = 0;
- this.KvadtratniM = 0;
- } */
- /// <summary>
- /// ///
- /// </summary>
- /// <param name="address"></param>
- public override string ToString()
- {
- return String.Format("Address: {0}; Floors: {1}; kvadratni Metra: {2}; Length:{3}",
- this.Address, this.Floors, this.KvadtratniM, Length);
- }
- }
- public class PlayWithBuldings
- {
- static void Main(string[] args)
- {
- Building parkHotel = new Building(
- "10 kvartal Iztok",
- 5,
- 1234.44
- );
- Building SoftUni = new Building(
- "15-17 Tintyva",
- 3,
- 444.55
- );
- SoftUni.Address = "nov adres Maika";
- Building kvartalPancharevo = new Building("jk.Pancherevo", 0 ,0.0);
- // kvartalPancharevo.Floors = 7; ne moejm zashtoto floor e - private get;
- Console.WriteLine(kvartalPancharevo);
- Console.WriteLine(parkHotel);
- Console.WriteLine(SoftUni);
- DateTime easter = new DateTime(2015, 4, 27, 4, 3, 6);
- DateTime christmas = new DateTime(2015, 12, 25);
- Console.WriteLine(easter);
- Console.WriteLine(christmas);
- }
- }
- ////////////////////////////////////////////////////////
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication35
- {
- class Program
- {
- public class Cat
- {
- private string name;
- private string owner;
- public Cat(string name, string owner)
- {
- this.Name = name;
- this.Owner = owner;
- }
- public string Name
- {
- get { return this.name;}
- set { this.name = value; }
- }
- public string Owner
- {
- get { return this.owner; }
- set { this.owner = value; }
- }
- public void SayMiau()
- {
- Console.WriteLine("Miauuuuuuuuu");
- }
- public override string ToString()
- {
- return String.Format("Name of cat : {0}; sobstvenik : {1}",
- this.Name, this.Owner
- );
- }
- }
- static void Main(string[] args)
- {
- Cat hoisss = new Cat("kor","hoi");
- Console.WriteLine(hoisss);
- hoisss.SayMiau();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement