Mittwoch lesson
This commit is contained in:
parent
e0efeb82ef
commit
8901dea11b
61 changed files with 663 additions and 0 deletions
3
Code/Steiner/Zootest/src/Animal.java
Normal file
3
Code/Steiner/Zootest/src/Animal.java
Normal file
|
@ -0,0 +1,3 @@
|
|||
public abstract class Animal {
|
||||
public abstract void makeSound();
|
||||
}
|
11
Code/Steiner/Zootest/src/Camel.java
Normal file
11
Code/Steiner/Zootest/src/Camel.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
public class Camel extends Animal implements Climbing {
|
||||
@Override
|
||||
public void makeSound() {
|
||||
System.out.println("Desert Camel grumbles!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void climb() {
|
||||
System.out.println("Desert Camel climbs a dune.");
|
||||
}
|
||||
}
|
3
Code/Steiner/Zootest/src/Climbing.java
Normal file
3
Code/Steiner/Zootest/src/Climbing.java
Normal file
|
@ -0,0 +1,3 @@
|
|||
public interface Climbing {
|
||||
void climb();
|
||||
}
|
16
Code/Steiner/Zootest/src/Eagle.java
Normal file
16
Code/Steiner/Zootest/src/Eagle.java
Normal file
|
@ -0,0 +1,16 @@
|
|||
public class Eagle extends Animal implements Flying, Swimming {
|
||||
@Override
|
||||
public void makeSound() {
|
||||
System.out.println("Eagle screams!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fly() {
|
||||
System.out.println("Eagle flies high in the sky.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swim() {
|
||||
System.out.println("Eagle fishes in the water (swims...).");
|
||||
}
|
||||
}
|
4
Code/Steiner/Zootest/src/Flying.java
Normal file
4
Code/Steiner/Zootest/src/Flying.java
Normal file
|
@ -0,0 +1,4 @@
|
|||
public interface Flying {
|
||||
void fly();
|
||||
}
|
||||
|
16
Code/Steiner/Zootest/src/Frog.java
Normal file
16
Code/Steiner/Zootest/src/Frog.java
Normal file
|
@ -0,0 +1,16 @@
|
|||
public class Frog extends Animal implements Swimming, Climbing {
|
||||
@Override
|
||||
public void makeSound() {
|
||||
System.out.println("Green Frog croaks!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swim() {
|
||||
System.out.println("Green Frog swims in the pond.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void climb() {
|
||||
System.out.println("Green Frog climbs a tree.");
|
||||
}
|
||||
}
|
3
Code/Steiner/Zootest/src/Swimming.java
Normal file
3
Code/Steiner/Zootest/src/Swimming.java
Normal file
|
@ -0,0 +1,3 @@
|
|||
public interface Swimming {
|
||||
void swim();
|
||||
}
|
17
Code/Steiner/Zootest/src/ZooTest.java
Normal file
17
Code/Steiner/Zootest/src/ZooTest.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
public class ZooTest {
|
||||
public static void main(String[] args) {
|
||||
Animal eagle = new Eagle();
|
||||
eagle.makeSound();
|
||||
((Eagle) eagle).fly();
|
||||
((Eagle) eagle).swim();
|
||||
|
||||
Animal frog = new Frog();
|
||||
frog.makeSound();
|
||||
((Frog) frog).swim();
|
||||
((Frog) frog).climb();
|
||||
|
||||
Animal camel = new Camel();
|
||||
camel.makeSound();
|
||||
((Camel) camel).climb();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue