1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
defon
3 years ago
12

Add the following method to the Point class: public double distance(Point other) Returns the distance between the current Point

object and the given other Point object. The distance between two points is equal to the square root of the sum of the squares of the differences of their x- and y-coordinates. In other words, the distance between two points (x1, y1) and (x2, y2) can be expressed as the square root of (x2 - x1)2 (y2 - y1)2. Two points with the same (x, y) coordinates should return a distance of 0.0.
public class Point {
int x;
int y;
// your code goes here
}
Computers and Technology
1 answer:
GaryK [48]3 years ago
3 0

Answer:

public class Point

{

  public int x;

  public int y;

  Point(int x,int y)

  {

      this.x=x;

      this.y=y;

  }

  public static void main(String[] args)

  {

      Point p1=new Point(-2,3);

      Point p2=new Point(3,-4);

      System.out.println("distance:"+distance(p1,p2));

 }

  private static double distance(Point p1,Point p2)

  {

      return Math.sqrt(Math.pow(p2.x-p1.x, 2)+Math.pow(p2.y-p1.y, 2));

  }

}

Explanation:

The java program defines the Point class and the public method 'distance' to return the total distance between the two quadrants passed to it as arguments (they are both instances of the Point class).

You might be interested in
Jill is interested in a career as a paramedic. She is trained to use medical equipment, she remains calm under pressure, and she
Igoryamba

This question is incomplete because it lacks the appropriate options

Complete Question:

Jill is interested in a career as a paramedic. She is trained to use medical equipment, she remains calm under pressure, and she has good bedside manner. Which career pathway would best fit Jill’s interests and skills?

A. Security and Protective Services

B. Law Enforcement Services

C. Emergency and Fire Management Services

D. Correction Services

Answer:

c) Emergency and Fire Management Services

Explanation:

Emergency and Fire Management Services is a career path or occupation where personnels work to ensure that there is a prompt emergency response to incidents or accidents whereby the safety of human lives and properties are threatened.

Emergency and Fire Management services deal with the following incidents listed below:

a) Fire incidents

b) Car accidents

c) Medical emergencies

Staffs or Personnels that work in Emergency and Fire Management services:

a) Fire Fighters

b) Paramedics

Personnels who work with Emergency and Fire Management services should have the following traits or characteristics.

a) They must be calm regardless of any situations they are in

b) They must have the ability and training to use essential medical equipments.

c) They must have excellent people skills as well as good bedside manners.

d) They must possess the ability to work under intense pressure

e) They must possess the ability to calm victims of fire or car accidents

In the question above, the career pathway that is best for Jill based on the skills and interests that she possesses is a career pathway in Emergency and Fire Management Services.

7 0
4 years ago
In a transaction-processing system (tps), if the tps database can be queried and updated while the transaction is taking place,
Alona [7]
This is called Real time processing. A Transaction Processing System (TPS) is a kind of data framework that gathers, stores, adjusts and recovers the information exchanges of an undertaking. Exchange handling frameworks additionally endeavor to give unsurprising reaction times to demands, despite the fact that this is not as basic with respect to continuous frameworks.
6 0
3 years ago
Maria found a cupcake recipe on a cooking blog. However, she would like to read comments and suggestions before she begins bakin
Mnenie [13.5K]
Maria should use the Cooking blog that has known and verified information and step by step instructions Comments can lead to disaster and/or incorrect recipe use
8 0
4 years ago
Read 2 more answers
The __________ process is designed to find and document vulnerabilities that may be present because there are misconfigured syst
erma4kov [3.2K]

Answer:

Isp

Explanation:

An Internet service provider is an organisation that provides services for accessing,

using, or participating in the Internet. Internet service providers can be organised in

various forms

6 0
3 years ago
1 MB equals to how many GBs? Or 1 GB = how many MBs? i want to know how many MBs equal a GB, or how many GBs equal a MB; i'm get
Deffense [45]
Approximately 1,000 MBs are in a gigabyte
5 0
4 years ago
Other questions:
  • Which of the following BEST represents the relationship between physical fitness and exercise?
    6·1 answer
  • In an airline reservation system, on entering the flight number, the flight schedule and the flight status are displayed. In thi
    13·2 answers
  • Imagine you just bought a cable installation company that routinely treats its residential customers poorly. You want your compa
    11·1 answer
  • What kind of battery does a dji spark have?
    12·1 answer
  • What data unit is addressed based on the IP address of the recipient?
    8·1 answer
  • Which of the following are common data types? Check all that apply.
    6·1 answer
  • A common practice is to create a(n) _____ on any field that is used as a search key, in comparison operations in a conditional e
    6·1 answer
  • Design a class named Person with fields for holding a person’s name, address, and telephone number. Write one or more constructo
    12·1 answer
  • Which of these is not part of the art director's job?
    9·2 answers
  • What symbol do we use to assign a value to a variable or constant in algorithms?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!