Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will write two java files for this assignment: MyCircle.java, and MyCircleTester.java. The MyCircle.java file is the primary interest. It will create an actual class,

You will write two java files for this assignment: MyCircle.java, and MyCircleTester.java.

The MyCircle.java file is the primary interest. It will create an actual class, the first one that we have written this semester. The MyCircle class is similar to the Rectangle class from the reading.

The MyCircle class should meet these criteria:

Three member fields

double radius

double x

double y

Eight methods:

Six of the methods are simple: getters and setters for x, y, and radius.

There should also be a getArea method that returns the area (derived from the radius)

A doesOverlap method. This method should accept a MyCircle as an argument, and return true if this circle overlaps the circle that the method was invoked on. [Note: two circles overlap if the sum of their radius' is greater than or equal to the distance between their centers.]

The reading this week discusses one of the UML diagrams. Here is the diagram for the MyCircle class:

MyCircle Class

double x

double y

double radius

void setX(double value)

double getX()

void setY(double value)

double getY()

void setRadius(double value)

double getRadius()

double getArea()

boolean doesOverlap(MyCircle otherCircle)

MyCircleTester

Write a second class named MyCircleTester. It should be in its own file named MyCircleTester.java. It should contain code that tests your MyCircle class. It should have a static main method, and if you want you can put all of the code inside that main method.

I encourage you to spend a significant amount of time testing out the MyCircle class. This is a great way to learn the nuances of java syntax. Feel free to write and erase as much code as you want. (Naturally.)

After you have tested the code to your own satisfaction, submit code that meets these minimum criteria

Allocate and initialize at least three MyCircle objects. Two of them should overlap, and two should not.

Display the areas of the three circles

Invoke doesOverlap on MyCircles to show which circles overlap.

Submit two files, inside a compressed folder. MyCircle.java and MyCircleTester.java

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions

Question

=+ (d) Restrict the range of summation in (5.51) to 0x

Answered: 1 week ago