a- Write a method that calculates and returns the distance between two points. The method takes four double parameters: x1, y1, x2, y2 and returns the distance between the two points calculated using the below formula. Distance = (x2 – x1)² + (y2 – Y1)² - The method header is as follows:

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter3: Using Methods, Classes, And Objects
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question

java program

a- Write a method that calculates and returns the distance between two points.
The method takes four double parameters: x1, y1, x2, y2 and returns the distance
between the two points calculated using the below formula.
Distance = V (22 – æ1)² + (y2 – y1)²
The method header is as follows:
public static double distance (double x1, double yl, double x2, double y2)
b- Write a program that allows the user to enter coordinates of circle center and radius then asks for
the coordination of each point to check if it is inside the circle or not. (point is inside the circle if
the distance between point and center is less than or equal to radius).
run:
Enter x and y coordinates of center and radius: 0 0 8
Enter x and y coordinates of the point: 2 4
Point is inside circle
Check another point? y
Enter x and y coordinates of the point: 7 12
Point is outside circle
Check another point? n
Transcribed Image Text:a- Write a method that calculates and returns the distance between two points. The method takes four double parameters: x1, y1, x2, y2 and returns the distance between the two points calculated using the below formula. Distance = V (22 – æ1)² + (y2 – y1)² The method header is as follows: public static double distance (double x1, double yl, double x2, double y2) b- Write a program that allows the user to enter coordinates of circle center and radius then asks for the coordination of each point to check if it is inside the circle or not. (point is inside the circle if the distance between point and center is less than or equal to radius). run: Enter x and y coordinates of center and radius: 0 0 8 Enter x and y coordinates of the point: 2 4 Point is inside circle Check another point? y Enter x and y coordinates of the point: 7 12 Point is outside circle Check another point? n
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Introduction to computer system
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
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,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage