6. asar
							parent
							
								
									c744258ef3
								
							
						
					
					
						commit
						ca68cff91a
					
				|  | @ -0,0 +1,14 @@ | ||||||
|  | 
 | ||||||
|  | public class Autoo extends Fahrzeug | ||||||
|  | { | ||||||
|  |      | ||||||
|  |     public Autoo(double m) | ||||||
|  |     { | ||||||
|  |         super(m, 4); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public Autoo(){ | ||||||
|  |         super(140, 4); | ||||||
|  |     } | ||||||
|  |     } | ||||||
|  |   | ||||||
|  | @ -0,0 +1,10 @@ | ||||||
|  | 
 | ||||||
|  | public class Fahrrad extends Fahrzeug | ||||||
|  | { | ||||||
|  |      | ||||||
|  | 
 | ||||||
|  |     public Fahrrad() | ||||||
|  |     { | ||||||
|  |         super(30, 2); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | @ -0,0 +1,35 @@ | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 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; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | @ -0,0 +1,19 @@ | ||||||
|  | 
 | ||||||
|  | public class Krankenwagen extends Autoo | ||||||
|  | { | ||||||
|  |     private boolean blaulicht; | ||||||
|  |     public Krankenwagen() | ||||||
|  |     { | ||||||
|  |         super(); | ||||||
|  |          | ||||||
|  |         blaulicht = false; | ||||||
|  |     } | ||||||
|  |     public void ein() { | ||||||
|  |         blaulicht = true; | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     public void aus() { | ||||||
|  |         blaulicht = false; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | @ -0,0 +1,10 @@ | ||||||
|  | 
 | ||||||
|  |                   | ||||||
|  | public class Rennwagen extends Autoo | ||||||
|  | { | ||||||
|  |      | ||||||
|  |     public Rennwagen() | ||||||
|  |     { | ||||||
|  |         super(220); | ||||||
|  |     } | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue