// A client of Point that instantiates three points and calculates // the circumference of the implied triangle. using System; public class Application{ public static Point PromptPoint(string prompt){ double x, y; AbstractPoint.PointRepresentation mode = AbstractPoint.PointRepresentation.Rectangular; Console.WriteLine(prompt); x = Double.Parse(Console.ReadLine()); y = Double.Parse(Console.ReadLine()); return new Point(mode,x,y); } public static void Main(){ AbstractPoint p1, p2, p3; double p1p2Dist, p2p3Dist, p3p1Dist, circumference; p1 = PromptPoint("Enter first point"); p2 = PromptPoint("Enter second point"); p3 = PromptPoint("Enter third point"); p1.Rotate(Math.PI); p2.Move(1.0, 2.0); p1p2Dist = Math.Sqrt((p1.X - p2.X) * (p1.X - p2.X) + (p1.Y - p2.Y) * (p1.Y - p2.Y)); p2p3Dist = Math.Sqrt((p2.X - p3.X) * (p2.X - p3.X) + (p2.Y - p3.Y) * (p2.Y - p3.Y)); p3p1Dist = Math.Sqrt((p3.X - p1.X) * (p3.X - p1.X) + (p3.Y - p1.Y) * (p3.Y - p1.Y)); circumference = p1p2Dist + p2p3Dist + p3p1Dist; Console.WriteLine("Circumference:\n {0}\n {1}\n {2}\n {3}", p1, p2, p3, circumference); } }