eeeeeeeeeeeeeeem
package edu.week5;
class ball {
float x;
float y;
int radius;
float xDelta;
float yDelta;
public void Ball(){
}
public void Ball(float x, float y, int radius, float xDelta, float yDelta){
this.x=x;
this.y=y;
this.radius=radius;
this.xDelta=xDelta;
this.yDelta=yDelta;
}
public float getX() {
return x;
}
public void setX(float x){
this.x=x;
}
public float getY(){
return y;
}
public void setY(float y){
this.y =y;
}
public int getRadius(){
return radius;
}
public void setRadius(int radius){
this.radius=radius;
}
public float getXDelta() {
return xDelta;
}
public void setxDelta(float xDelta){
this.xDelta=xDelta;
}
public float getYDelta() {
return xDelta;
}
public void setyDelta(float yDelta){
this.yDelta=yDelta;
}
public void move(){
x += xDelta;
y += yDelta;
}
public void reflectHorizontal(){
xDelta = - xDelta;
}
public void reflectVertical(){
yDelta = yDelta;
}
public String toString(){
return " Ball[("+x+","+y+"), speed = ( "+xDelta+","+yDelta+")]";
}
}