-
Notifications
You must be signed in to change notification settings - Fork 0
/
Piece.java
61 lines (56 loc) · 1.38 KB
/
Piece.java
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
54
55
56
57
58
59
60
61
/**
* Write a description of class Piece here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Piece
{
// instance variables - replace the example below with your own
private String description;
private double prixunit;
private double poidsunitkg;
private boolean fragile;
private boolean TVAred;
/**
* Constructor for objects of class Piece
*/
public Piece(String d, double pr, double po, boolean fr, boolean TVA)
{
this.description=d;
this.prixunit=pr;
this.poidsunitkg=po;
this.fragile=fr;
this.TVAred=TVA;
}
/**
*constructeur a deux paramètres
*/
public Piece(String d, double pr)
{this.description=d;
this.prixunit=pr;
}
public String getDescription(){
return description;
}
public double getprixunit(){
return prixunit;
}
public double getpoidsunit(){
return poidsunitkg;
}
public boolean getfragile(){
return fragile;}
public boolean getTVAred(){
return TVAred;}
/**
* methoque qui renvoit si deux objets sont identiques
*/
public boolean equals(Object a){
if(a!=null && (a instanceof Piece )){
Piece p =(Piece) a;
return (this.getdescription()==p.getdescription() && this.getprixunit()==p.getprixunit());
}
return false;
}
}