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
2 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]2 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
Which part of project management involves determining the required materials?
Katyanochek1 [597]
Resources I think because what u have all depends on resources
5 0
3 years ago
Read 2 more answers
A pointing device used mainly for computer games is known as
kolbaska11 [484]

Answer: Joystick is the only one that makes sense, a stylus and digitizer are both used on drawing tablets, not computer games.

5 0
2 years ago
What is the function of the kernel of an operating system? It is an application that allows the initial configuration of a Cisco
Phoenix [80]

Answer:The kernel provisions hardware resources to meet software requirements.

Explanation: Kernel is the program which behaves as the central component of the operating system.The main purpose of the kernel is to control the operation of the system to manage it.

Monolithic kernel and micro-kernel are two types of kernel units present in the computer system where they work for fulfilling the software requirement by attaching it to the hardware parts.

Other option are incorrect because it does not work for Cisco device, does not perform any specific feature only , no linkage is created between the hardware and the electronics nor reacts as navigation bar.

3 0
3 years ago
Felicity wants to capture the attention of the regular subway commuters in her area though her print advertisements​
mel-nik [20]

Answer: billboard

Explanation:

Plato answer

8 0
2 years ago
Serena, an analyst at an environmental agency, wants to prepare a report using data from the Car Emissions database.
konstantin123 [22]

Answer:

The correct answer is:

Option 1: export the query results from the database to a spreadsheet, then export the graph to a document.

Explanation:

Spreadsheets are used to represent numerical data, perform calculations and display the results numerically or graphically.

When using a database, the query results can be exported to other software using the query web address.

So in order to include the graph in her report, Serena will export the result to spreadsheet and then export the graph to document.

Hence,

The correct answer is:

Option 1: export the query results from the database to a spreadsheet, then export the graph to a document.

5 0
2 years ago
Read 2 more answers
Other questions:
  • What are some ways to accept data typed into a cell? Check all that apply.
    15·1 answer
  • Notes page view and Outline view are found in the<br> tab.<br> File<br> O Status<br> View<br> Page
    8·1 answer
  • Which computer applications can Mr. Crowell use to make the classroom learning more stimulating and interesting? Mr. Crowell has
    9·2 answers
  • A(n) __________attack is designed to render the target unreachable by legitimate users, not to provide the attacker access to th
    8·1 answer
  • The ____________ mechanism consists of a lever arm attached to the mousetrap spring.
    15·1 answer
  • A occurs when you reset a mobile device but retain your installed applications and personal settings
    10·2 answers
  • What is the name of the arm that is attached to the read/write head?
    13·1 answer
  • A serial schedule:
    8·1 answer
  • Implemente a função ao lado, que recebe um preço e um booleano indicando se já está com desconto ou não. Se o preço for maior qu
    8·1 answer
  • What should a pie chart represent?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!