Blame view

tp2_banques/tp2/operations_historisees/CompteEpargne.java 911 Bytes
fed1c83c   Vincent Benoist   tp2 et 3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  
  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();
      }
      
  }