Point
Point
import java.util.Scanner;
/**
* Write a description of class Podouble here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Point
{
double x;//This variable stores the numeric value in the x axis
double y;//This variable stores the numeric value in the y axis
ans.x = -x;
ans.y = -y;
File: Untitled Document 1 Page 2 of 3
return ans;
}
ans.x = (x + P.x) / 2;
ans.y = (y + P.y)/2;
return ans;
}
Point p1;
p1 = new Point();
Point p2;
p2 = new Point(3 , 5);
p1.readCoordinates();
System.out.println();
p1.printCoordinates();
System.out.println();
p2.printCoordinates();
System.out.println();
switch(option)
{
case 1:
System.out.print("The Distance between the two points are:" +
p1.distance(p2.x , p2.y));
break;
case 2:
System.out.print("The reflection in origin of point 1 is:" +
p1.reflectionOrigin());
System.out.print("The reflection in origin of point 2 is:" +
p2.reflectionOrigin());
break;
case 3:
System.out.print("The midpoint of the two points are:" + p1.midPoint(p2));
break;
}
/**
* Output
*
* Enter the coordinates of x axis 3
Enter the coordinates of y axis 4
File: Untitled Document 1 Page 3 of 3