-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcom.tw.trainning.Item.java
More file actions
69 lines (59 loc) · 1.06 KB
/
com.tw.trainning.Item.java
File metadata and controls
69 lines (59 loc) · 1.06 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
63
64
65
66
67
68
69
package com.tw.trainning;
/**
* This is the supermarket shop item to print
* @author hp
*
*/
public class Item
{
private String name;
private int count;
private double price;
private double total;
private int promotionCount;
private String unit;
public Item(String n, int c, double p, double t, int pc, String u)
{
name = n;
count = c;
price = p;
total = t;
promotionCount = pc;
unit = u;
}
public String name()
{
return name;
}
public int count()
{
return count;
}
public double price()
{
return price;
}
public double total()
{
return total;
}
public int promotionCount()
{
return promotionCount;
}
public String unit()
{
return unit;
}
public String toString()
{
StringBuffer sBuf = new StringBuffer();
sBuf.append("name: ").append(name);
sBuf.append(", count: ").append(count);
sBuf.append(", price: ").append(price);
sBuf.append(", total price: ").append(total);
sBuf.append(", promotion count: ").append(promotionCount);
sBuf.append(", unit: ").append(unit);
return sBuf.toString();
}
}