-
Notifications
You must be signed in to change notification settings - Fork 0
/
src_Product.java
52 lines (41 loc) · 992 Bytes
/
src_Product.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
public class Product {
private static int products = 0;
private int mySKU;
private String myName;
private int myPrice;
private double displayPrice;
public Product() {
}
public Product(String name, int price) {
products++;
mySKU = products;
myName = name;
myPrice = price;
}
public static int getProducts() {
return products;
}
public int getMySKU() {
return mySKU;
}
public void setMySKU(int mySKU) {
this.mySKU = mySKU;
}
public String getMyName() {
return myName;
}
public void setMyName(String myName) {
this.myName = myName;
}
public int getMyPrice() {
return myPrice;
}
public void setMyPrice(int myPrice) {
this.myPrice = myPrice;
}
@Override
public String toString() {
displayPrice = (double) myPrice/100;
return ("Name: " + myName + ", Price: " + displayPrice);
}
}