using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Square_Point_Line
{
public class Point
{
public Point()
{
}
public Point(double x,double y)
{
this.X = x;
this.Y = y;
}
public double X { get; set; }
public double Y { get; set; }
public void ShowPoint()
{
Console.WriteLine("\t\n [x={0},y={1}]",X,Y);
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Square_Point_Line
{
public class Line
{
public Line()
{
}
public Line(Point a,Point b)
{
this.A = a;
this.B = b;
}
public double Length
{
get
{
return Math.Sqrt(Math.Pow(A.X - B.X, 2) + Math.Pow(A.Y - B.Y, 2));
}
}
public Point A { get; set; }
public Point B { get; set; }
public void DisplayLine()
{
Console.WriteLine("LengthOfLine={0}",this.Length);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Square_Point_Line
{
public class Square
{
public Square()
{
}
public Square(Line ab,Line bc,Line cd,Line da)
{
this.AB = this.BC = this.CD = this.DA = ab;
}
public Square(Point a,Point b,Point c,Point d)
{
this.A = a;
this.B = b;
this.C = c;
this.D = d;
}
public Line AB { get; set; }
public Line BC { get; set; }
public Line CD { get; set; }
public Line DA { get; set; }
public Point A { get; set; }
public Point B { get; set; }
public Point C { get; set; }
public Point D { get; set; }
}
}
}