CompteEpargne.java 1022 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();
    }
    
    public void echeance(){
        crediter(interets());
    }
    
    public void debiter(double val){
        if((getCredit()-val)>0){
            setDebit(getDebit()+val);
        
        }else {
            System.out.println("Compte non débitable");
        }
    }
    
    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(); 
    }
    
    public String toString(){
      return super.toString()+" Interets du mois: "+ interets();
    }
    
}