Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Define a class named Circle. A Circle object stores a radius and the (x,y) coord

ID: 3664126 • Letter: D

Question

Define a class named Circle. A Circle object stores a radius and the (x,y) coordinates of its center point. Each Circle object should have 3 private fields, x-coordinate,y-coordinate and radius. Each circle object should have the following public methods:

Circle(x,y,radius)

getX()

getY()

getRadius()

getArea()

getCircumference ()

toString()

contains(x,y)

Then write a client class named CircleClient. It should create an object of class Circle and initialize it to (10.5) and Radius to 7. Print the object Print out its circumference and area. If point(5,7) lies within the clircle print "(5,7) lies within the circle" else print "(5,7)doesnot lie within the clircle".

Explanation / Answer

import java.util.Scanner;

import java.lang.math;

class Circle

{

public static void main(String[] args)

{

java.util.scanner scn=new java.util.Scanner(System.in)

int i=scn.nextInt();

point=new Point(5,7);

contains(10.5

radius =r;

}

int getradius()

{

return radius;

}

double getarea()

{

area=Math.PI*radius*radius;

System.out.println(“the radius is”);

}

double circumference=Math.PI*2*radius;

{

circumference=Math.PI*2*radius;

System.out.println(“The circumference of a circle is”);

}

public Circle(double X,double Y)

{

this.x=X;

this.y=Y;

}

double getX()

{

return X;

}

double getY()

{

return Y;

}

class CircleClient

radius=7;

circle=10.5;

if(point(5,7))

{

System.out.println(“this lies within the point”);

}

else

{

System.out.println(“this does not lies within the point”);

}

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote