设计一个Point类, 能够:
(1) 对应于Point a,b(1);
添加缺省构造函数和构造函数,使a点初始化为(0,0)点,b点初始化为对应的x轴上的点。
(2)对应于 Point c(1,2);添加构造函数
(3)设置点的坐标
(4)显示点的坐标
(5)判断该点是在第几象限,并显示判断结果
(6)能够计算出两点间的距离
(7)程序运行到最后,可以调用Point的统计总点数的功能,统计在main函数中到底产生了几个类对象。
java编写一个表示坐标点的类(Point),其中包含x和y两个坐标点的值,并且...
this.y = y; } public displayPoint (){ \/\/输出坐标 System.out.println("x:"+x+",y:"+y); } public static distancePoint(Point p1, Point p2){ \/\/计算坐标距离 int a = p1.getX()-p2.getX(); int b = p1.getY()-p2.getY(); return Math....
Java定义一个Point(点)类
public class Point { public static void main(String[] args){ Point p1=new Point();Point p2=new Point(1,2);p1.show();p1.move(3,4);p1.show();p2.show();p2.move(5,6);p2.show();} Point(){ this(0,0);} Point(float x,float y){ this.x=x;this.y=y;} void...
求高手用JAVA帮我设计一个完整的Point类,可以计算两点之间距离和中间...
public static void main(String[] args) { Point p = new Point(1,1,2,2);p.TestPoint();} } 如果还有其他要求的话,我再改进一下。
java编程题,写一个point类,计算两个point实例间的距离
public class Test { public static void main(String[] args){ Point p1 = new Point(0,0);Point p2 = new Point(100, 0);System.out.print(p1.getDistance(p2));} }
java 编程创建一个Point类
public class Test102 { public static void main(String[] args) { Point point = new Point();point.printPoint();point.moveTo(1, 3);System.out.println("--移动后--");point.printPoint();} } class Point { private float x;private float y;public Point() { this.x = 0;this...
java设计题:设计一个Point类,该类包含两个Int型成员变量:x,y,一个Co...
import java.awt.Color;public class Point { private int x;\/\/x坐标 private int y;\/\/y坐标 private Color color;\/\/颜色 public Point() {\/\/不带参数的构造方法 } public Point(int x,int y) {\/\/带两个参数的构造方法 this.x = x;this.y = y;} public Point(int x,int y,Color ...
java编程 定义一个类Point,代表一个点,public属性有x和y,方法有显示点...
} public static MyPoint getMiddle(MyPoint p1,MyPoint p2){ MyPoint p = new MyPoint((p1.x+p2.x)\/2,(p1.y+p2.y)\/2); return p; }}文件Test.java public class Test{ public static void main(String[] args){ MyPoint p1 = new MyPoint(); MyPoint ...
求大神帮忙写一下程序,用java写 定义一个Point类,用来表示二维空间中...
public class Point {private double x;private double y;\/\/ 获取距离public double getDistance(Point p) {return Math.sqrt(Math.pow(x - p.x, 2) + Math.pow(y - p.y, 2));}\/\/ 测试public static void main(String[] args) {Point p1 = new Point(1, 0);Point p2 = new Point...
java定义一个点类(point),包含x,y坐标数据成员,显示函数(show)和计算...
point point1;point point2;int getarea(point point1, point point2){ int length = point1.x - point2.x;int width = point1.y - point2.y;return Math.abs(width)*Math.abs(length);} double length(point point1, point point2){ int length = point1.x - point2.x;int width...
java设计一个表示二维平面上点的类Point
Point() { } Point( int x, int y ) { this.x = x; this.y = y; } Point( Point p ) { this.x = p.getx(); this.y = p.gety(); } public int getx() { return x; } public int gety() { return y; } public void setx( int x ) { this.x = x; }...