-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProduct.java
More file actions
62 lines (51 loc) · 1.22 KB
/
Copy pathProduct.java
File metadata and controls
62 lines (51 loc) · 1.22 KB
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
62
public abstract class Product{
/**
* The new line separator
*/
private String NL = System.getProperty("line.separator");
/**
* This atribute stores the product identification code
*/
private String id;
/**
* This atribute stores the product material object
*/
private Material material;
/**
* Constructor method
*
* @param id
* the Product's id
* @param material
* the Product's material object
*/
public Product(String id, Material material) {
this.id = id;
this.material = material;
}
/**
* Getter method of atribute id
* @return atribute id
*/
public String getId() {
return this.id;
}
/**
* Getter method of atribute material
* @return atribute material
*/
public Material getMaterial() {
return this.material;
}
/**
* Abstract method price (developed in every subclass)
*/
abstract double price();
/**
* This method generates and returns an String with
* the product identification code.
*/
public String toString() {
return "Product id: " + this.id + NL;
}
}