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 07:30
What key should you press and hold to select and open multiple files at one time? enter alt control esc
Answers: 1
question
Computers and Technology, 23.06.2019 15:30
Hey so i was just trying out some game hacks so i took a paste from online and built it in my visual studio and then suddenly my computer was working or clicking on stuff on its own am i hacked?
Answers: 1
question
Computers and Technology, 23.06.2019 21:50
Description: write function lastfirst() that takes one argument—a list of strings of the format "lastname, firstname" —and returns a list consisting of two lists: (a) a list of all the last names (b) a list of all the first names
Answers: 2
question
Computers and Technology, 24.06.2019 00:30
Asecurity policy is a a. set of guidlines b. set of transmission protocols c. written document d. set of rules based on standards and guidelines
Answers: 2
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
History, 23.03.2021 19:50
question
Arts, 23.03.2021 19:50
question
History, 23.03.2021 19:50
question
Chemistry, 23.03.2021 19:50
question
Mathematics, 23.03.2021 19:50
question
Mathematics, 23.03.2021 19:50
Questions on the website: 13722363