###################################测试类####################################
package MyPackage;
}
###################################Dot类#####################################
package MyPackage;
public class Dot {
int dx,dy,d_x,d_y;//点点坐标
double x_y;
public double distance(int dx,int dy,int d_x,int d_y) {
x_y = Math.sqrt(Math.pow((dx-d_x),2)+Math.pow((dy-d_y),2));
System.out.println("两点距离:"+x_y);
return x_y;//点点距离
}
}
###################################Oval类####################################
package MyPackage;
public class Oval {
int ox,oy,o_x,o_y;//o圆心坐标;o_点坐标
int r;
double l,s,d;
public double Ovall(double r) {
l=2*Math.PI*r;
System.out.println("圆周长:"+l);
return l;
}
public double Ovals(double r) {
s=Math.PI*r*r;
System.out.println("圆面积:"+s);
return s;
}
public double Ovald(int ox,int oy,int o_x,int o_y) {
d=Math.sqrt(Math.pow((ox-o_x),2)+Math.pow((oy-o_y),2));
if(d>r) {
System.out.println("点在圆外,"+"点到圆心距离为:"+d);
}
else if(d==r) {
System.out.println("点在圆上,"+"点到圆心距离为:"+d);
}
else {
System.out.println("点在圆内,"+"点到圆心距离为:"+d);
}
return d;
}
}
###################################Rect类####################################
package MyPackage;
public class Rect {
int rx,ry,rwx,rwy,rhx,rhy,rdx,rdy;//左上坐标,一边坐标,另一边坐标,点坐标
double l,s;
String str;
public double Rectl(int rx,int ry,int rwx,int rwy,int rhx,int rhy){
int rw = ry-rwy;//宽
int rh = rhx-ry;//高
l = 2*(rw+rh);
System.out.println("方周长:"+l);
return l;
}
public double Rects(int rx,int ry,int rwx,int rwy,int rhx,int rhy){
int rw = ry-rwy;//宽
int rh = rhx-ry;//高
s = rw*rh;
System.out.println("方面积:"+s);
return s;
}
public String Rectd(int rdx,int rdy) {
if(rdx
String str = "点在方外";
System.out.println(str);
}
else if(rdx==rx||rdx==rhx||rdy==rwy||rdy==ry) {
String str = "点在方上";
System.out.println(str);
}
else {
String str = "点在方内";
System.out.println(str);
}
return str;
}
}