using System; namespace Lapid2 { class Lapp { protected double x; protected double y; public Toon varvus; public Lapp(double x, double y, Toon varvus) { this.x = x; this.y = y; this.varvus = varvus; } public Lapp Poolita() { if (x > y) { x = x / 2; } else { y = y / 2; } return new Lapp(x, y, varvus); } public override String ToString() { return "Lapp laiusega " + this.x + " pikkusega " + this.y + " tooniga " + varvus; } } enum Toon {Sinine, Punane, Kollane}; class Lapikatse { public static void Main(string[] arg) { Lapp lapp1 = new Lapp(25, 20, Toon.Kollane); Lapp lapp2 = lapp1.Poolita(); Lapp lapp3 = lapp2.Poolita(); Console.WriteLine(lapp1.ToString()); Console.WriteLine(lapp2.ToString()); Console.WriteLine(lapp3.ToString()); } } }