ment: Circle.java

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 1GZ
icon
Related questions
Question

JAVA PROGRAMMING

Write two java files for this assignment: Circle.java, and Main.java.

The Circle.java file will create an actual class.  

The Circle class:

MEMBER VARIABLE

  • double radius
  • 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.]

 

void setX(double value)

double getX()

void setY(double value)

double getY()

void setRadius(double value)

double getRadius()

double getArea()

boolean doesOverlap(Circle otherCircle)

 

second class will be the typical replit Main class, with its static main method .It should contain code that tests the Circle class. submit code that meets the criteria below after testing

  • Allocate and initialize at least three Circle objects. Two of the three should overlap, and two should not.
  • Display the areas of the three circles
  • Invoke doesOverlap on Circles to show which circles overlap.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT