i'm trying to fix the script i wrote:
import java.util.Scanner;
public class Line2
{
public static void main (String [] args)
{
Scanner scan = new Scanner (System.in);
System.out.println ("Please enter 4 integers");
int x1 = scan.nextInt();
int y1 = scan.nextInt();
int x2 = scan.nextInt ();
int y2 = scan.nextInt ();
double distance;
//Asking the user to insert coordinates of both points and setting double
// on distance in order to properly calculate the square root
distance = Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
System.out.print( "the length of the line between the points" (int x1, int x2) "and" (int y1, int y2) "is" distance);
//Telling the program to calculate the distance of two points given by user
}//end of method main
}
I'm trying to make x1
x2
y1
and y2
appear inside, however it doesn't allow me - gives Y (sort of) expected...
What can i do in order for it to appears no matter what the int
is? (other than that the program runs pretty well, i think..)
Thank you