/* * Authored by: Zille Huma Kamal and Ajay Gupta */ using System; class Point { private int x, y; public Point() { } public Point(int xvalue, int yvalue) { X = xvalue; Y = yvalue; } public int X { get { return x; } set { x = value; } } public int Y { get { return y; } set { y = value; } } public override string ToString() { return base.ToString() + " at [" + X + ", " + Y + "]"; } }//end of class Point class Circle : Point { private double radius; public Circle() { } public Circle(int xvalue, int yvalue, double radiusvalue) : base(xvalue, yvalue) { Radius = radiusvalue; } public double Radius { get { return radius; } set { if (value >= 0)radius = value; } } public double Diameter() { return Radius * 2; } public double Circumference() { return Math.PI * Diameter(); } public virtual double Area() { return Math.PI * Math.Pow(Radius, 2); } public override string ToString() { return base.ToString() + " with Radius = " + Radius; } }//end of class Circle class Test { public static void Main() { Point p1 = new Point(30, 50); Circle c1 = new Circle(120, 89, 2.7); Circle c2 = new Circle(5, 6, 2.0); Console.WriteLine("p1 is " + p1); Console.WriteLine("c1 is " + c1); Console.WriteLine("c2 is " + c2); c2 = c1; Console.WriteLine("c2 now is " + c2); } }//end of class Test