如果有人看到我的上一篇文章,那么,我找到了我的钥匙。
我得到了这个UML,并被要求为驱动程序编写代码。我的驱动程序在图表上有一些点,并询问代码是否相交,至少这是我得到的。我完全没了?如果它不合适,我会在评论中发布UML。
public class Box
{
private double x;
private double y;
private int width;
private int height;
public Box ( double intiX, double intiY, int width, int height )
{
x = intiX;
y = intiY;
width = this.width;
height = this.height;
}
public move(double newX, double newY);
{
x = newX;
y = newY;
}
public int area()
{
area = width*height;
}
public double getMinX()
{
minX = x -(width/2);
return minX;
}
public double getMaxX()
{
maxX = x +(width/2);
return maxX;
}
public double getMinY()
{
minY = y-(height/2);
return minY;
}
public double getMaxY()
{
maxY = y+(height/2);
return maxY;
}
public boolean intersects(Box b)
{
if(getmaxY() < b.getMinY() )
{
return false;
}
if