Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

a. Distance: This method takes as its parameters four numbers that represent two

ID: 3543551 • Letter: A

Question

a. Distance: This method takes as its parameters four numbers that represent two points in the plane and returns the distance between them.

b. Radius: This method takes as its parameter four numbers that represent the center and a point on the circle, calls the method distance to find the radius of the circle, and returns the circleâs radius.

c. Circumference: This method takes as its parameter a number that represents the radius of the circle and returns the circleâs circumference. (if r is the radius, the circumference is 2(Pi)r.)

d. Area: This method takes as its parameter a number that represents the radius of the circle and returns the circleâs area. (If r is the radius, the area is (Pi)r^2.)

e. Assume that Pi =3.1416

I already have the radius, circumference, and area. I just need help with adding the distance as an output in the equation

Explanation / Answer

public class NewClass {
    public static void main(String[] args) {
            Scanner s = new Scanner(System.in);
            int x1,x2,y1,y2;
            x1 = s.nextInt();
            x2 = s.nextInt();
            y1 = s.nextInt();
            y2 = s.nextInt();
            System.out.println("dis"+new NewClass().distance(x1, x2, y1, y2));
    }
    public double distance(int x1, int x2, int y1, int y2){                               
        return Math.sqrt((Math.pow((x2-x1), 2) + Math.pow((y2-y1), 2)));
    }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote