-
Notifications
You must be signed in to change notification settings - Fork 0
/
order.java
53 lines (46 loc) · 1.49 KB
/
order.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
public class order {
private Integer customerId;
private Integer orderId ;
private product [] products ;
private float totalprice ;
public order(Integer customerId, Integer orderId, product[] products, float totalprice) {
this.customerId = Math.abs(customerId);
this.orderId = Math.abs(orderId);
this.products = products;
this.totalprice = Math.abs(totalprice);
}
public Integer getCustomerId() {
return customerId;
}
public product[] getProducts() {
return products;
}
public float getTotalprice() {
return totalprice;
}
public Integer getOrderId() {
return orderId;
}
public void setCustomerId(Integer customerId) {
this.customerId = Math.abs(customerId);
}
public void setProducts(product[] products) {
this.products = products;
}
public void setOrderId(Integer orderId) {
this.orderId = Math.abs(orderId);
}
public void setTotalprice(float totalprice) {
this.totalprice = Math.abs(totalprice);
}
public void printorderinfo() {
System.out.println("order id : " + orderId);
System.out.println("customer id: " + customerId);
System.out.println("products:");
for (product product : products) {
System.out.println("name: " + product.getName());
System.out.println("price: $" + product.getPrice());
}
System.out.println("total Price: $" + totalprice);
}
}