Compte.java
836 Bytes
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
45
46
47
public class Compte {
double credit = 0;
double debit = 0;
public double getCredit(){
return this.credit;
}
public double getDebit(){
return this.debit;
}
public void setCredit(double x){
this.credit = x;
}
public void setDebit(double x){
this.debit = x;
}
public Compte(){
}
public Compte(double val){
setCredit(val);
}
public void crediter(double val){
setCredit(getCredit()+val);
}
public void debiter(double val){
setDebit(getDebit()+val);
}
public double solde(){
return (getCredit()-getDebit());
}
public String toString(){
return "Votre solde actuel est de "+solde()+" ("+getCredit()+" - "+getDebit()+")";
}
}