import
java.io.*;
class
distance
{
int x,y,dist;
distance()
{ x=0;
y=0;
}
void calc(distance c,distance d)
{
int
xd=c.x-d.x;
int xs=xd*xd;
int yd=c.y-d.y;
int ys=yd*yd;
int sum=xs+ys;
double dist=Math.sqrt(sum);
System.out.println("The distance is
"+dist);
}
void read()throws IOException
{
BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
System.out.println("Enter the x
coordinate");
x=Integer.parseInt(br.readLine());
System.out.println("Enter the y
coordinate");
y=Integer.parseInt(br.readLine());
System.out.println("The entered point
is "+"("+x+","+y+")");
}
public static void main(String s[])throws
IOException
{
distance c=new distance();
distance d=new distance();
System.out.println("First
point");
c.read();
System.out.println("Second
point");
d.read();
d.calc(c,d);
}
}
Output
|
This blog is mainly developed for individuals,who were interested in programming using C,C++,java and SQL.
kuşadası
ReplyDeletemilas
çeşme
bağcılar
tekirdağ
6MA8E8
kuşadası transfer
ReplyDeletefoça transfer
alaçatı transfer
didim transfer
karşıyaka transfer
LQİNTN