-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathValeur.java
More file actions
54 lines (41 loc) · 957 Bytes
/
Valeur.java
File metadata and controls
54 lines (41 loc) · 957 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
48
49
50
51
52
53
public class Valeur {
private int prix;
private float charge= (float) 0.12;
private int toPay;
public Valeur(int prix) {
this.setPrix(prix);
}
public Valeur(int prix,float charge) {
this(prix);
this.charge = charge;
}
private void updateToPay () {
this.toPay=(int) (prix*(1+charge));
}
public int getPrix() {
return prix;
}
public void setPrix(int prix) {
this.prix = prix;
updateToPay();
}
public int getToPay() {
return toPay;
}
public void setCharge(int charge) {
this.charge = charge;
updateToPay();
}
public String toString() {
return toPay+"";
}
public long actualiz(byte years, int surface, boolean balcon, boolean terrace) {
float r= (float) 0.7;
double actualized;
if (balcon) { r+= (float) 0.4; }
if (terrace) { r+= (float) 0.3; }
actualized = this.prix * Math.pow(1 + r, years);
if (surface > 150) { actualized += 120 * years; }
return Math.round(actualized);
}
}