subject

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

}
2.

create a class called name that represents a person's name. the class should have fields named firstname representing the person's first name, lastname representing their last name, and middleinitial representing their middle initial (a single character). your class should contain only fields for now.

3.

add two new methods to the name class:

public string getnormalorder()
returns the person's name in normal order, with the first name followed by the middle initial and last name. for example, if the first name is "john", the middle initial is 'q', and the last name is "public", this method returns "john q. public".

public string getreverseorder()
returns the person's name in reverse order, with the last name preceding the first name and middle initial. for example, if the first name is "john", the middle initial is 'q', and the last name is "public", this method returns "public, john q.".

4.

add the following method to the point class:

public int quadrant()

returns which quadrant of the x/y plane this point object falls in. quadrant 1 contains all points whose x and y values are both positive. quadrant 2 contains all points with negative x but positive y. quadrant 3 contains all points with negative x and y values. quadrant 4 contains all points with positive x but negative y. if the point lies directly on the x and/or y axis, return 0.

public class point {
private int x;
private int y;

// your code goes here

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 05:00
In cell b18, enter a formula to calculate the amount budgeted for meals. this amount is based on the daily meal allowance and the total travel days (# of nights+1).
Answers: 1
question
Computers and Technology, 24.06.2019 01:00
What shows the web address of the page that is currently displayed in the workspace? status window toolbar location bar internet box
Answers: 1
question
Computers and Technology, 24.06.2019 10:10
Scanning the road can be thought of as a
Answers: 2
question
Computers and Technology, 24.06.2019 13:30
To move an excel worksheet tab, simply right-click on it drag and drop it double-click on it delete it
Answers: 1
You know the right answer?
Add the following method to the point class:

public double distance(point other)
<...
Questions
question
Mathematics, 15.07.2019 13:30
question
Biology, 15.07.2019 13:30
question
Mathematics, 15.07.2019 13:30
question
Mathematics, 15.07.2019 13:30
Questions on the website: 13722360