QuestionQuestion

Transcribed TextTranscribed Text

OBJECT-ORIENTED THINKING Problem Description: The Circle2D Class 1- Define the Circle2D class that contains:  Two double data fields named x and y that specify the center of the circle with getmethods. (5 points)  A data field radius with a get method. (5 points)  A no-arg constructor that creates a default circle with (0, 0) for (x, y) and 1 for radius. (5 points)  A constructor that creates a circle with the specified x, y, and radius. (5 points)  A method getArea() that returns the area of the circle.(5 points)  A method getPerimeter() that returns the perimeter of the circle.(5 points)  A method contains(double x, double y) that returns true if the specified point (x, y) is inside this circle. See Figure (a). (15 points)  A method contains(Circle2D circle) that returns true if the specified circle is inside this circle. See Figure (b).(12.5 points)  A method overlaps(Circle2D circle) that returns true if the specified circle overlaps with this circle. See Figure (c) below.(12.5 points) Implement the class. 2- Write a test program TestCircle2D.java that creates a Circle2D object:  new Circle2D(2, 2, 5.5)(6 points)  displays its area and perimeter(6 points)  displays the result of c1.contains(3, 3)(6 points)  displays the result of c1.contains(new Circle2D(4, 5, 10.5))(6 points)  displays the result of c1.overlaps(new Circle2D(3, 5, 2.3))(6 points) a) A point is inside the circle. (b) A circle is inside another circle. (c) A circle overlaps another circle.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

/**
*
*/
public class Circle2D {

    /**
    * Two double data fields named x and y that specify the center of the
    * circle with getmethods. (5 points)
    */
    private double x;
    private double y;

    /**
    * getter
    *
    * @return s
    */
    public double getX() {
       return x;
    }

    /**
    * getter
    *
    * @return y
    */
    public double getY() {
       return y;
    }

    /**
    * A data field radius with a get method. (5 points)
    */
    private double radius;

    /**
    * getter
    *
    * @return radius
    */
    public double getRadius() {
       return radius;
    }

    /**
    * A no-arg constructor that creates a default circle with (0, 0) for (x,
    * y) and 1 for radius. (5 points)
    */
    public Circle2D() {
       x = 0.0;
       y = 0.0;
       radius = 1.0;
    }

    /**
    * A constructor that creates a circle with the specified x, y, and radius.
    * (5 points)
    *
    * @param x
    * @param y
    * @param radius
    */
    public Circle2D(double x, double y, double radius) {
       this...

By purchasing this solution you'll be able to access the following files:
Circle2D.java and TestCircle2D.java.

$15.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats