package chasingevading; import java.util.Random; public class Mobile { float x, y; int speed; float dir; public Mobile(){ x=0; y=0; Random rnd = new Random(); setSpeed(3); setDir(rnd.nextFloat()*360*(float)Math.PI/180); } public Mobile(int x, int y){ setX(x); setY(y); Random rnd = new Random(); setSpeed(3); setDir(rnd.nextFloat()*360*(float)Math.PI/180); } public float getX(){ return x; } public void setX(int x){ this.x = x; } public void setX(float x){ this.x = x; } public void setX(double x){ this.x = (float)x; } public float getY(){ return y; } public void setY(int y){ this.y = y; } public void setY(float y){ this.y = y; } public void setY(double y){ this.y = (float)y; } public float getDir() { return dir; } public void setDir(float dir) { float gradDir = dir*180/(float)Math.PI; gradDir = gradDir%360; this.dir = gradDir*(float)Math.PI/180; } public int getSpeed() { return speed; } public void setSpeed(int speed) { this.speed = speed; } }