class Circle 
{
	int xorigin = 5;
	int yorigin = 5;
	int radius = 4;
	Circle(){}
	Circle(int x1, int y1, int r) 
	{
		xorigin = x1; yorigin = y1; radius = r;
	}
	Circle(Coordinate P, int r1) 
	{
		xorigin = P.x;
		yorigin = P.y;
		radius = r1;
	}
	void disp()
	{
		System.out.println("Centre is "+xorigin+" " +yorigin);
		System.out.println("The radius is " +radius);
	}
	public static void main (String args[])
	{
		Circle C1 = new Circle();
		Circle C2 = new Circle(10, 15, 5);
		Circle C3 = new Circle(new Coordinate(10,10),6);
		C1.disp();
		C2.disp();
		C3.disp();
	}
}
class Coordinate 
{
	int x, y;
	Coordinate (int x1, int y1)
	{
		x=x1;y=y1;
	}
}

Click here to go back.

Our aim is to provide information to the knowledge seekers.


comments powered by Disqus
Footer1