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;
- namespace _12.RectangleProperties
- {
- 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);
- }
- }
- class RectangleProperties
- {
- 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(rec.PerimeterCalc);
- Console.WriteLine(rec.AreaCalc);
- Console.WriteLine(rec.DiagonalCalc);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement