Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assignment - Circle Class You will write two java files for this assignment: Circle.java, and Main.java. The Circle.java file is the primary interest. It
Assignment - Circle Class You will write two java files for this assignment: Circle.java, and Main.java. The Circle.java file is the primary interest. It will create an 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 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 does Overlap 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) Circle Tester Your second class will be the typical replit Main class, with its static main method.It should contain code that tests your Circle class. 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 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 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. Here is a sample tester that uses hardwired values: Tester with hardwired values Here is a sample tester that uses user input: Tester with user input Notes On Overlapping Circles The doesOverlap method is the most challenging method in the assignment. Mostly I am interested in the method as a way for everyone to think about what it means to have one circle interact with another circle in a method invocation that looks like this: firstCircle.doesOverlap (secondCircle) I hope people don't feel too tripped up by the geometry. Two circles overlap if the sum of their radii is equal to or larger than the distance between their centers. We can work out the geometry logic in the discussion board. The Math.pow, Math.sqrt, and Math.hypot methods can help.
Step by Step Solution
★★★★★
3.37 Rating (156 Votes )
There are 3 Steps involved in it
Step: 1
Circle java class Please go through the comments to understand the lines of code java class Circle Three member fields private double radius private d...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started