subject

Task: 1. Define a class named Circle.
2. A Circle object stores a radius and the (x, y) coordinates of its center point using Point class (Point class should be similar to the one we wrote during lectures. It should have at least two private fields to store x and y coordinates of a point, one constructor, a toString method and a distance method).
3. Each Circle object should have 2 private fields, a Point object and radius. Each Circle Object should have the following public method:
Circle (p-radius)
Constructs a new circle with a center specified by the given Point p and with the given integer radius.
getcentert ()
Returns point object for the center of the circle.
getRadius ()
Returns the circle's radius.
getArea ()
Returns the area occupied by the circle, using the formula pir2.
get circumference ()
Returns the circle's circumference (distance around the circle), using the formula 2nr.
teostring ()
Returns a string representation of the circle, such as "Circle [center=(75, 20), radius=30]".
contains (p)
Returns true if the point p lies within the circle else returns false. (Hint: calculate the distance between the center and the point p and compare it with the radius).
Write a client class named CircleClient. It should create an object of class Circle and initialize it to point (10,5) and radius 7. Print the object. Print out its circumference and area. If point (5,7) lies within the circle print "(5,7) lies within the circle" else print "(5,7) does not lie within the circle".

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 17:00
The camera still is bad even with the new iphone xr and especially in low light it is even worst because you can see the pixels more if its in low light. if all you apple customers want apple to fix this then lets fill there feedback with complaints about the
Answers: 1
question
Computers and Technology, 23.06.2019 21:00
Which set of steps will organize the data to only show foods with more than 100 calories and rank their sugar content from greatest to least?
Answers: 1
question
Computers and Technology, 24.06.2019 00:10
Read each statement below. if the statement describes a peer-to-peer network, put a p next to it. if the statement describes a server-based network, put an s next to it. p - peer-to-peer s - server-based
Answers: 1
question
Computers and Technology, 24.06.2019 01:00
What shows the web address of the page that is currently displayed in the workspace? status window toolbar location bar internet box
Answers: 1
You know the right answer?
Task: 1. Define a class named Circle.
2. A Circle object stores a radius and the (x, y) coord...
Questions
question
Mathematics, 31.07.2020 01:01
question
Biology, 31.07.2020 01:01
question
Social Studies, 31.07.2020 01:01
question
Mathematics, 31.07.2020 01:01
question
Mathematics, 31.07.2020 01:01
Questions on the website: 13722367