CompteEpargne.java 911 Bytes

public class CompteEpargne extends Compte {

    private double interet;
    
    public double getInteret(){
        return this.interet;
    }
    
    public void setInteret(double x){
        this.interet = x;
    }
    
    public double interets(){
       // return (getCredit()-getDebit())*getInteret();
        return (soldeCredit()-soldeDebit())*getInteret();
    }
    
    public void echeance(){
        crediter(interets());
    }
    
    public void debiter(double val){
        if((soldeCredit()-val)>0){
           super.debiter(soldeDebit()+val);
        
        }
    }
    
    public CompteEpargne(double creditInit, double interet){
        super(creditInit);
        setInteret(interet);
    }
    
    public CompteEpargne(){
        super();
        setInteret(0.1);
    }
    
    public String etat(){
        return super.toString()+" Interets du mois: "+ interets();
    }
    
}