FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java-Programs/coordinate.java at main · VirajPatidar/Java-Programs · GitHub
VirajPatidar
/
Java-Programs
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java-Programs
/
coordinate.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
22 lines (22 loc) · 724 Bytes
Breadcrumbs
Java-Programs
/
coordinate.java
Copy path
File metadata and controls
22 lines (22 loc) · 724 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import
java
.
util
.
Scanner
;
class
coordinate
{
double
x
;
double
y
;
void
set
(){
Scanner
sc
=
new
Scanner
(
System
.
in
);
System
.
out
.
println
(
"Enter the co-ordinates"
);
x
=
Double
.
parseDouble
(
sc
.
nextLine
());
y
=
Double
.
parseDouble
(
sc
.
nextLine
());
}
void
distance
(
coordinate
pt2
,
coordinate
pt1
) {
double
dis
=
Math
.
sqrt
((
pt2
.
x
-
pt1
.
x
)*(
pt2
.
x
-
pt1
.
x
) + (
pt2
.
y
-
pt1
.
y
)*(
pt2
.
y
-
pt1
.
y
));
System
.
out
.
println
(
"The distance between the co-ordinates is: "
+
dis
);
}
public
static
void
main
(
String
[]
args
) {
coordinate
ob1
=
new
coordinate
();
coordinate
ob2
=
new
coordinate
();
ob1
.
set
();
ob2
.
set
();
ob2
.
distance
(
ob2
,
ob1
);
}
}
Back
|
FazBrowse Home
|
New Git URL