TestComptes.java 1008 Bytes


public class TestComptes{
    
    public static void main(String[] args){
    
        Compte unCompte = new Compte();
        CompteEpargne unCE = new CompteEpargne();
        System.out.println(unCompte.toString());
        System.out.println(unCE.toString());
        
        unCompte.crediter(100.0);
        unCE.crediter(200.0);
        
        System.out.println(unCompte.toString());
        System.out.println(unCE.toString());
        //unCompte.etat();
        System.out.println(unCE.etat());
       
        //unCE=unCompte; -> incompatibletype
    
        
        Banque b = new Banque();
        b.crediter(unCompte, 10);
        b.debiter(unCompte, 235);
        System.out.println(b.etat(unCompte));
        
        b.crediter(unCE, 10);
        b.debiter(unCE, 235);
        System.out.println(b.etat(unCE));
        
        unCompte=unCE;
        
        b.crediter(unCompte, 10);
        b.debiter(unCompte, 235);
        System.out.println(b.etat(unCompte));
    }
    
    
}