help me lord

This commit is contained in:
Sage The DM 2024-11-23 21:34:00 +01:00
parent fb196693e4
commit db6b2a2a6e
42 changed files with 342 additions and 0 deletions

Binary file not shown.

View file

@ -0,0 +1,10 @@
// Hauptprogramm App
public class App {
public static void main(String[] args) {
Auto auto = new Auto("Ferrari");
Boot boot = new Boot("Titanic");
auto.bewegen();
boot.bewegen();
}
}

Binary file not shown.

View file

@ -0,0 +1,12 @@
// Klasse Auto
public class Auto extends Fahrzeug {
public Auto(String name) {
super(name);
}
@Override
public void bewegen() {
System.out.println("Das Auto " + getName() + " fährt auf der Strasse.");
}
}

Binary file not shown.

View file

@ -0,0 +1,11 @@
// Klasse Boot
public class Boot extends Fahrzeug {
public Boot(String name) {
super(name);
}
@Override
public void bewegen() {
System.out.println("Das Boot " + getName() + " fährt auf dem Wasser.");
}
}

Binary file not shown.

View file

@ -0,0 +1,14 @@
// Basisklasse Fahrzeug
public abstract class Fahrzeug {
private String name;
public Fahrzeug(String name) {
this.name = name;
}
public String getName() {
return name;
}
public abstract void bewegen();
}