Repository navigation
Expand file tree
/
Copy pathOrder.java
More file actions
54 lines (42 loc) · 1.46 KB
/
Copy pathOrder.java
File metadata and controls
54 lines (42 loc) · 1.46 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
// Constructor
// getter setter??
public class Order {
// Data Field
// data types will change
private User orderingUser;
private Product orderedProduct;
private CreditCard creditCard;
private int orderQuantity;
// method that can access "product--> stock control method" "user-->product ordering"
public Order(User orderingUser, Product orderedProduct, CreditCard creditCard, int orderingQuantity) {
this.orderingUser = orderingUser;
this.orderedProduct = orderedProduct;
this.creditCard = creditCard;
this.orderQuantity = orderQuantity;
}
public void processOrder() {
if (orderedProduct.getStockQuantity() >= orderQuantity) {
if (orderedProduct.getStockQuantity() >= orderQuantity) {
orderingUser.orderProduct(orderedProduct, orderQuantity);
}
}
}
public User getOrderingUser() {
return orderingUser;
}
public void setOrderingUser(User orderingUser) {
this.orderingUser = orderingUser;
}
public Product getOrderedProduct() {
return orderedProduct;
}
public void setOrderedProduct(Product orderedProduct) {
this.orderedProduct = orderedProduct;
}
public CreditCard getCreditCard() {
return creditCard;
}
public void setCreditCard(CreditCard creditCard) {
this.creditCard = creditCard;
}
}