33 lines
637 B
Java
33 lines
637 B
Java
|
|
public class Fahrzeug
|
|
{
|
|
private double position;
|
|
private double speed;
|
|
private double max;
|
|
private int wheels;
|
|
|
|
public void bewege( double time){
|
|
this.position += speed*time/60;
|
|
}
|
|
|
|
public void setSpeed(double s ) {
|
|
this.speed = s;
|
|
if (this.speed > this.max) this.speed = this.max;
|
|
}
|
|
|
|
public double getMaxSpeed(){
|
|
return this.max;
|
|
}
|
|
|
|
public int getWheelCount(){
|
|
return this.wheels;
|
|
}
|
|
|
|
public Fahrzeug(double m, int w){
|
|
this.position = 0;
|
|
this.speed = 0;
|
|
this.max = m;
|
|
this.wheels = w;
|
|
}
|
|
}
|