+ 2

JAVA program on to find the mid-point of a line....

Guys, I need help on a program in which a function is to designed that is called by reference to find the mid-point of a line whose endpoints are given. Thanks in advance....

14th Sep 2017, 9:29 AM
Karan Kumar
Karan Kumar - avatar
4 Antworten
+ 3
Like something like this: class point{int x,int y}; point mid-point(point endpoint1,point endpoint2) { point mid; mid.x=(endpoint1.x+endpoint2.x)/2; mid.y=(endpoint1.y+endpoint2.y)/2; return mid; }
14th Sep 2017, 10:09 AM
matmozaur
matmozaur - avatar
+ 1
yes @matmozour thanks man
14th Sep 2017, 10:43 AM
Karan Kumar
Karan Kumar - avatar
0
It won't be just point which coordinates will be arithmetic mean of endpoints coordinates?
14th Sep 2017, 10:05 AM
matmozaur
matmozaur - avatar
0
start point + endpoint divided by 2.
14th Sep 2017, 3:18 PM
shobhit
shobhit - avatar