Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Finding the distance between the centers of two circles object with radius 5 . 5 and center as ( 3 . 5 , 4 .

Finding the distance between the centers of two circles object with radius 5.5 and center as (3.5,4.2). Then test all the get methods, set methods, and the
distance method.
Grading: This lab is worth 100 points. Out of 100 maximum points, the UML will count for
20 points, the two source codes will count for 80 points.
How to hand in the assignment
Follow the steps below:
Complete the UML in a Microsoft Word document or other document file format, and the
programs in .java files. Once you are done, convert your UML file to a PDF (.pdf).
Upload the .java files as well as the PDF document UML into Gradescope. Do not
submit a .docx file for the UML, first convert your file to PDF (.pdf).
Click "Upload".
I remind you that if you do not submit the assignment before the due date, you will not be able to
submit it.
Note: Your output should look exactly like the output below and should be able to run test
cases.
Circle 1's Radius: 1.0
Circle 1's CenterX: 1.0
Circle 1's CenterY: 1.0
Circle 2's Radius: 5.5
Circle 2's CenterX: 3.5
Circle 2's CenterY: 4.2
Distance from Circle1 to Circle2: 4.060788100849391
Based on the following class:
Complete the Circle class by adding three sets of get and set methods for the three private data
fields. In the Circle class, add another instance method that is passed a reference variable for a
circle object and returns the distance between the circle that is passed to the method and the
current circle. Your distance method should have the following signature line:
public double distance(Circle c)
The distance formula between any two points (x1,y1) and (x2,y2) is given by:
d=(x2-x1)2+(y2-y1)22
Requirements: (1) Draw the UML of the new Circle class; (2) Implement the Circle class; (3) In
another program file, implement a test program for a new class named TestCircle with a main
method. Save the two program files as Circle.java and TestCircle.java.
In the main method of the TestCircle class, use the Circle constructors to create a first circle
object with the default radius (use the no-arg constructor for this) and create a second circle
image text in transcribed

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

Students also viewed these Databases questions