38 lines
619 B
Java
38 lines
619 B
Java
public class Animal{
|
|
|
|
//Instanzvariabeln
|
|
protected int size;
|
|
protected int age;
|
|
protected String name;
|
|
protected String breed;
|
|
protected String haut;
|
|
|
|
/*Konstruktor
|
|
Animal (int a, int s, String n, String b, String h){
|
|
age = a;
|
|
size = s;
|
|
name = n;
|
|
breed = b;
|
|
haut = h;
|
|
}
|
|
|
|
Animal (String n, String b){
|
|
this.name = n;
|
|
this.breed = b;
|
|
}*/
|
|
|
|
|
|
//Methoden
|
|
public void eat(){
|
|
System.out.println("Munch munch");
|
|
}
|
|
|
|
public String getName(){
|
|
return this.name;
|
|
}
|
|
|
|
public String getInfo(){
|
|
return "This is " + name + " a " + breed + " which is " + age + " Years old and has a height of " + size + ". Its skin is " + haut + ".";
|
|
}
|
|
|
|
} |