Assignment - Circle Class You will write two java files for this assignment: Circle.java, and Main.java....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
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... View the full answer
Related Book For
Data Modeling and Database Design
ISBN: 978-1285085258
2nd edition
Authors: Narayan S. Umanath, Richard W. Scammel
Posted Date:
Students also viewed these programming questions
-
1-45. A machine having a mass of 4200 kg is supported by three solid steel rods arranged as shown in AS 35 A&x ABY BC BC TBCA 4.2 AN = BD 1
-
In this assignment, you will create a program that allows theuser to draw in a window using brushes of different sizes andcolors. The user will be able to change the size and color of thebrush using...
-
Go to https://www.eclipse.org/ide/ to download the latest version of the Eclipse IDE and install it Mac users: You will need to choose x86_64 or AArch64 depending on your type of mac. x86_64 is for...
-
3 (a) A laser beam of uniform cross-sectional area passes through air into a glass block (refractive index 1.5). Determine the ratios of (i) the velocities (ii) the frequencies and (iii) the...
-
A bungee jumper leaps from a bridge and undergoes a series of oscillations. Assume g = 9.78 m/s2. (a) If a 60.0-kg jumper uses a bungee cord that has an unstretched length of 33.0 m and she jumps...
-
C. At this lower wind speed, if we consider formaldehyde to be non-conservative such that it is lost in the atmosphere at a rate of 0.33/hr, estimate the steady state concentration over the city.
-
What is the significance of high frequency trading?
-
Ming Companys chart of accounts includes the following selected accounts. 101 Cash 201........Accounts Payable 120 Merchandise Inventory...306 T. Ming, Drawing 130 Prepaid Insurance.....505 Cost of...
-
You have been consulted by Marvel Enterprises, a start-up IT company, to provide some suggestions for how they can encourage their employees to practice work-life balance. Create a tip sheet that the...
-
Howies Bakery is one of the most popular bakeries in town, and the favorite at Howies is French bread. Each day of the week, Howies bakes a number of loaves of French bread, more or less according to...
-
1 8.33 points Skipped Problem 16-1 (Algo) Required: A call option with a strike price of $58 on a stock selling at $67 costs $9.5. What are the call option's intrinsic and time values? (Round your...
-
Define dynamic object types. Besides the example in this chapter, can you think of other situations where we would encounter them?
-
Provide examples of Web services and discuss the contribution of Web services to the efficiency of information systems.
-
Explain the difference between design, analysis, and patterns.
-
The Object Adapter pattern has great potential for design. Provide examples.
-
A 50 -W incandescent light bulb emits about \(5.0 \mathrm{~W}\) of visible light. (The rest is converted to thermal energy.) If a circular aperture \(5.0 \mathrm{~mm}\) in diameter is placed \(1.0...
-
Insert the loops from parts A, and B below into a script element in the body below an hl that says Last Lab! Run the code and insert comments that answer the questions. A. How many times does the...
-
Estimate a range for the optimal objective value for the following LPs: (a) Minimize z = 5x1 + 2x2 Subject to X1 - x2 3 2x1 + 3x2 5 X1, x2 0 (b) Maximize z = x1 + 5x2 + 3x3 Subject to X1 + 2x2 +...
-
What is a deletion constraint?
-
How are multi-valued dependencies incorporated into the definition of fourth normal form (4NF)?
-
Display the subassemblies of a snow shovel in the same top to bottom order as shown there: The level 2 nodes need not be displayed in the same left to right order as shown in the figure: Shovel...
-
An increase in which component of quality costs is most likely to result in a decrease in the other three components? a. prevention costs b. inspection costs c. internal failure costs d. external...
-
Activity-based costing can be used to refine which of the following? a. job-order costing b. process costing c. both job-order and process costing d. neither job-order nor process costing
-
How might the proportion of total quality control costs in each of the four components of quality control (prevention, inspection, internal failure, and external failure) vary for different types of...
Study smarter with the SolutionInn App