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

Can someone help me for question 9 to 16? there are all short anwers.... java fi

ID: 3596918 • Letter: C

Question

Can someone help me for question 9 to 16? there are all short anwers....

java file

9) Show the statenont) that you used so success fully creale a new dowble that stores the y coo rdinate of the midpoint of AB tatemenn(s) that you used to successfully create a new LineSegment ondpoints are the milpoint of AB and the midpoint of CD 10) Show the s 11) Show the statementi(s) that you used to successfully display the distance fro distance froem the midpoint of All to the first point of CD 12) Show the statement(s) that you used to successfully display the distance from the first point of CD to the erigin Show the statemen(s) that use the toString) method of the Point class to display the second point of AB 13) 14) Show the statement that uses the toString) method of the Point class to display BOTH peints of AB. 15) Show the statement that you used to successfully change the first point of AB so that it is the same as the midpoint of CD. 16) Show the statement(s) that you used to successfully change the x coordinate of the first point of AB so that it is the same as the x coordinate of the second point of CD. 2.

Explanation / Answer

9.
CSC142Point alpha = new CSC142Point( 1, 6 );   //Creates a point A.
CSC142Point beta = new CSC142Point( 5, 1 );       //Creates a point B.
Calling the method midPoint(),
CSC142Point mid = alpha.midPoint(beta);       //Creates another point mid, which is the mid point of A, B.
//Calculates the midpoint of a line AB.
public CSC142Point midPoint(CSC142Point other) {
double midX = (x + other.x) / 2;
double midY = (y + other.y) / 2;   //This statement creates a new double titled midY that stored Y-coordinate of the midpoint AB.
return new CSC142Point(midX, midY);
}

10.
CSC142Point A = new CSC142Point(1, 6);   //Creates a point A.
CSC142Point B = new CSC142Point(5, 1);   //Creates a point B.
CSC142Point C = new CSC142Point(7, 6);   //Creates a point C.
CSC142Point D = new CSC142Point(-7, -8);   //Creates a point D.

CSC142Point E = A.midPoint(B);   //Creates a mid point of AB.
CSC142Point F = C.midPoint(D);   //Creates a mid point of CD.

LineSegment line = new LineSegment(E, F);   //Creates a line segment with the midpoints of AB, and CD.

11.
CSC142Point A = new CSC142Point(1, 6);   //Creates a point A.
CSC142Point B = new CSC142Point(5, 1);   //Creates a point B.
CSC142Point C = new CSC142Point(7, 6);   //Creates a point C.
CSC142Point D = new CSC142Point(-7, -8);   //Creates a point D.

CSC142Point mid = A.midPoint(B);   //Creates a mid point of AB.
LineSegment line = newLineSegment(C, D);   //Creates a line segment with the points C, D.
CSC142Point other = line.getFirstPoint();   //Gets the first point on CD and stores in other.
double dist = mid.distance(other);   //Gets the distance from midpoint of AB, to firstpoint of CD.

12.
CSC142Point C = new CSC142Point(7, 6);   //Creates a point C.
CSC142Point D = new CSC142Point(-7, -8);   //Creates a point D.
LineSegment line = newLineSegment(C, D);   //Creates a line segment with the points C, D.
CSC142Point other = line.getFirstPoint();   //Gets the first point on CD and stores in other.
CSC142Point origin = new CSC142Point();   //Creates an origin point.
double dist = origin.distance(other);   //Display the distance from firstpoint of CD, to the origin.

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