-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProduct.java
More file actions
38 lines (33 loc) · 933 Bytes
/
Product.java
File metadata and controls
38 lines (33 loc) · 933 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
package GestCom;
public class Product {
private String reference;
private int quantite;
private double prix;
private double taux;
public void initProd(String r,int q,double p,double t){
this.reference = r;
this.quantite = q;
this.prix = p;
if(t >= 0 && t <=100){
this.taux = t;
}
}
public void ChangerTaux(double t){
if(t >= 0 && t <=100){
this.taux = t;
}else{
this.taux=0;
}
}
public double CalculPrix(){
return this.prix + (this.prix * this.taux) / 100;
}
public void Affiche(){
System.out.println("[ "
+"reference:"+this.reference+" , "
+"quantite:"+this.quantite+" , "
+"prix:"+String.format("%.2f",this.prix)+" , "
+"Taux de taxe:"+String.format("%.2f", this.taux)
+" ]");
}
}