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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 18:00, adrianaglass12
Which virus-infecting components are email messages prone to carry? one of the problems associated with the use of email communication is that email messages are prone to carry virus-infecting .
Answers: 3
image
Computers and Technology, 23.06.2019 02:00, rah45
Which of the following is not a source of sustainable raw materials? a) coal mine b) flick of sheep c) cotton plantation d) line forest.
Answers: 2
image
Computers and Technology, 23.06.2019 02:30, reyne36
Rafael needs to add a title row to a table that he has inserted in word. what should he do? use the alignment options. use the merge and center option for all the cells in the top row. use the merge and center option on the first two cells in the top row. none of the above
Answers: 3
image
Computers and Technology, 23.06.2019 20:00, noah12345678
What multimedia system creates an immersive, real-life experience that the user can interact with?
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 in other subjects: