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, 22.06.2019 11:00
The great length of north america causes the climate to be varied. true false
Answers: 2
question
Computers and Technology, 23.06.2019 00:30
If joey was single and his taxable income was $9,500, how much would he pay in taxes each year?
Answers: 1
question
Computers and Technology, 23.06.2019 04:31
Cloud computing service providers manage different computing resources based on the services they offer. which resources do iaas and paas providers not manage? iaas providers do not manage the for the client, whereas paas providers usually do not manage the for their clients. iaas- storage server operating system network paas- applications interafce storage vertualiation
Answers: 2
question
Computers and Technology, 23.06.2019 21:00
Will this setup result in what kathy wants to print?
Answers: 2
You know the right answer?
Add the following method to the point class:

public double distance(point other)
<...
Questions
question
Biology, 03.07.2020 02:01
question
History, 03.07.2020 02:01
question
Mathematics, 03.07.2020 02:01
question
Mathematics, 03.07.2020 02:01
question
History, 03.07.2020 02:01
question
Mathematics, 03.07.2020 02:01
question
Mathematics, 03.07.2020 02:01
Questions on the website: 13722367