36 lines
671 B
Java
36 lines
671 B
Java
|
|
|
|
public class Fahrzeug
|
|
{
|
|
private double position;
|
|
|
|
private double speed;
|
|
|
|
private double max;
|
|
|
|
private int wheels;
|
|
|
|
public void bewege(double time) {
|
|
position += speed * time / 60;
|
|
}
|
|
|
|
public void setGeschwindigkeit(double s) {
|
|
this.speed = s;
|
|
if (this.speed>this.max){
|
|
this.speed = this.max;
|
|
}
|
|
}
|
|
public double getGeschwindigkeit() {
|
|
return this.max;
|
|
}
|
|
public int getAnzahlRaeder(){
|
|
return this.wheels;
|
|
}
|
|
public Fahrzeug(double m,int w) {
|
|
this.position = 0;
|
|
this.speed = 0;
|
|
this.max = m;
|
|
this.wheels = w;
|
|
}
|
|
}
|