forked from BenjaminChun/OODP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SaleItem.java
68 lines (60 loc) · 1.48 KB
/
SaleItem.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
62
63
64
65
66
67
68
/**
* Represents the Invoice Manager in a restaurant.
* @author Tan Zheng Kai
* @version 1.0
* @since 2021-11-13
*/
public class SaleItem {
/**
* The order item of this Sale Item.
*/
private OrderItem orderItem;
/**
* The quantity of this Sale Item.
*/
private int quantity;
/**
* Creates a sale item with a given quantity.
* @param orderItem Order Item of this Sale Item.
* @param quantity Quantity of this Sale Item.
*/
public SaleItem(OrderItem orderItem , int quantity) {
this.orderItem = orderItem;
this.quantity = quantity;
}
/**
* Gets the order item of this sale item.
* @return the order item of this sale item.
*/
public OrderItem getOrderItem() {
return this.orderItem;
}
/**
* Changes the order item of this sale item.
* @param orderItem this sale item's order item.
*/
public void setOrderItem(OrderItem orderItem) {
this.orderItem = orderItem;
}
/**
* Gets the quantity of this sale item.
* @return the quantity of this sale item.
*/
public int getQuantity() {
return this.quantity;
}
/**
* Changes the quantity of this sale item.
* @param quantity The quantity of this sale item.
*/
public void setQuantity(int quantity) {
this.quantity = quantity;
}
/**
* Increase the quantity by a specified value.
* @param addition The specified value to be added.
*/
public void incrementQuantity(int addition) {
this.quantity += addition;
}
}