Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Rectangle_Calc
- {
- public double width { get; set; }
- public double heigth { get; set; }
- public double AreaCalc
- {
- get
- {
- return width * heigth;
- }
- }
- public double PerimeterCalc
- {
- get
- {
- return 2 * width + 2 * heigth;
- }
- }
- public double DiagonalCalc
- {
- get
- {
- return Math.Sqrt(width * width + heigth * heigth);
- }
- }
- public override string ToString()
- {
- return string.Format("{0}", AreaCalc);
- }
- }
- static void Main(string[] args)
- {
- double widthRec = double.Parse(Console.ReadLine());
- double heightRec = double.Parse(Console.ReadLine());
- Rectangle_Calc rec = new Rectangle_Calc { width = widthRec, heigth = heightRec };
- Console.WriteLine($"Perimater: {rec.PerimeterCalc}");
- Console.WriteLine($"Area: {rec.AreaCalc}");
- Console.WriteLine($"Diagonals: {rec.DiagonalCalc}");
- }
Advertisement
Add Comment
Please, Sign In to add comment