/* B E S C H R E I B U N G
gleiche Version wie bei der Version mit abstraktem Nutztier.
Zusätzlich wird hier ein Interface benutzt.
*/

public class MainInterface1{
    public static void main(String[] args){
    	double w1, w2, w3, w4;
    	Kuh myk=new Kuh("Elsa", 100);
    	Henne myh=new Henne ("Frida", 1);
    	w1=myk.getTierwert();
    	w2=myh.getTierwert();
    	w3=myk.getGewinn();    	
    	w4=myh.getGewinn();
    	
    	myk.printAllAttributs();
    	myh.printAllAttributs();    	
    }
}

abstract class Nutztier{
	// Name des Tiers
	private String name;
	
	public Nutztier(String pname){
		name = pname;
	}

	abstract public double getTierwert();
	
	public double getGewinn(){
		return(0.1*getTierwert());
	}

    public void printAllAttributs(){
    	System.out.println("Name des Nutztiers = "+name);    	
    }    
}

class Kuh extends Nutztier implements Druckbar{
    private double milchLeistung;
    public Kuh(String pName, double pMilchLeistung){
    	super(pName);
    	milchLeistung =pMilchLeistung; 
    }

    public double getTierwert(){
      return(100 * milchLeistung);
    }

    public void printAllAttributs(){
    	super.printAllAttributs();    	
    	System.out.println("Milchleistung= "+milchLeistung);
    }
} 


class Henne extends Nutztier implements Druckbar{
    private double legeLeistung;
    public Henne(String pName, double pLegeLeistung){
    	super(pName);
    	legeLeistung =pLegeLeistung; 
    }

    public double getTierwert(){
      return(2 * legeLeistung);
    }

    public void printAllAttributs(){
    	super.printAllAttributs();
    	System.out.println("Legeleistung= "+legeLeistung);    	
    }    
}
