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

Follow these instructions for your programming problems: . You must follow the g

ID: 3750811 • Letter: F

Question

Follow these instructions for your programming problems: . You must follow the good programming practices discussed in class . You must include appropriate comments in your code. For each programming problem, you must create an output text file as discussed in the labs that will show your complete console. You can combine all the console outs into single .txt file but clearly indicate which program they go with ° Be sure that you understand your program completely in English before you try to solve the problem in Java. It helps if you rewrite the problem statement in your own words before you begin coding. Be sure that you think about the explicitly defined information and the implied information from the problem statement. 1. Distance between two points Write a program to determine the distance between two points. Each point will be entered as X1Y1zi and X2,Y2.Z2 as coordinates in three dimensions. Enter the values from the console The distance formula is (x1%2)?+ (y1-y29 + (Z1-Z29 Print out the values for X1 YZ1 and X2,Y2,Z2 and then the distance between them. When you have completed this project run your program for each of the two sets of values listed below (each row is a different problem). Save the output after each run to turn in with this assignment. 1114 5 2.2 3.1 4.12 4 Hint: Answer for first set of values is 25 under square root with answer 5

Explanation / Answer

import java.util.Scanner;

class DistanceBetweenPoint

{

public static void main(String arg[])

{

int x1,x2,y1,y2,z1,z2;

double distance;

Scanner sc=new Scanner(System.in);

System.out.println("enter x1 point");

x1=sc.nextInt();

  

System.out.println("enter y1 point");

y1=sc.nextInt();

System.out.println("enter z1 point");

z1=sc.nextInt();

System.out.println("enter x2point");

x2=sc.nextInt();

System.out.println("enter y2 point");

y2=sc.nextInt();

System.out.println("enter z2 point");

z2=sc.nextInt();

  

distance=Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)+(z2-z1)*(z2-z1)); //distance formula

  

System.out.println("distancebetween"+"("+x1+","+y1+","+z1+"),"+"("+x2+","+y2+""+z2+")="+distance);//print distance

}

}