From ca68cff91acad381299a605411822de0562cbc6a Mon Sep 17 00:00:00 2001 From: Minkra <@> Date: Mon, 27 Nov 2023 17:19:35 +0100 Subject: [PATCH] 6. asar --- Autoo.java | 14 ++++++++++++++ Fahrrad.java | 10 ++++++++++ Fahrzeug.java | 35 +++++++++++++++++++++++++++++++++++ Krankenwagen.java | 19 +++++++++++++++++++ Rennwagen.java | 10 ++++++++++ 5 files changed, 88 insertions(+) create mode 100644 Autoo.java create mode 100644 Fahrrad.java create mode 100644 Fahrzeug.java create mode 100644 Krankenwagen.java create mode 100644 Rennwagen.java diff --git a/Autoo.java b/Autoo.java new file mode 100644 index 0000000..9fae3f0 --- /dev/null +++ b/Autoo.java @@ -0,0 +1,14 @@ + +public class Autoo extends Fahrzeug +{ + + public Autoo(double m) + { + super(m, 4); + } + + public Autoo(){ + super(140, 4); + } + } + diff --git a/Fahrrad.java b/Fahrrad.java new file mode 100644 index 0000000..b9aceea --- /dev/null +++ b/Fahrrad.java @@ -0,0 +1,10 @@ + +public class Fahrrad extends Fahrzeug +{ + + + public Fahrrad() + { + super(30, 2); + } +} diff --git a/Fahrzeug.java b/Fahrzeug.java new file mode 100644 index 0000000..6fb6c01 --- /dev/null +++ b/Fahrzeug.java @@ -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; + } +} diff --git a/Krankenwagen.java b/Krankenwagen.java new file mode 100644 index 0000000..314767d --- /dev/null +++ b/Krankenwagen.java @@ -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; + } +} + diff --git a/Rennwagen.java b/Rennwagen.java new file mode 100644 index 0000000..2ffe772 --- /dev/null +++ b/Rennwagen.java @@ -0,0 +1,10 @@ + + +public class Rennwagen extends Autoo +{ + + public Rennwagen() + { + super(220); + } +}