Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will write two java files for this assignment: Circle.java, and CircleTester.java. The Circle.java file is the primary interest. It will make actual class, the

You will write two java files for this assignment: Circle.java, and CircleTester.java.

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

The Circle class should meet these criteria:

Three member fields

  • doubleradius
  • double x
  • double y

Eight methods:

  • Six of the methods are simple:getter's and setter's 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 Circle 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 Circle class:

Circle 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(Circle otherCircle)

CircleTester

create second class named CircleTester. It should be in its own file named CircleTester.java. It should contain code that tests your Circle 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 Circle class. This is a great way to learn the nuances of java syntax. Feel free to create 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 Circle objects. Two of them should overlap, and two should not.
  • Display the areas of the three circles
  • Invoke doesOverlap on Circles to show which circles overlap.

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

=+c. What is the money multiplier? (Assume no currency holdings.)

Answered: 1 week ago