-
Notifications
You must be signed in to change notification settings - Fork 0
/
orderItem.java
59 lines (35 loc) · 1.12 KB
/
orderItem.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
/*************************
* orderItem.java
* represents a order item in a restaurant reservation and preorder app
* @author Chris Carmine
* @version 1.0
***********************/
public class orderItem{
//testing git again
private int qty;
private double extPrice;
private menuItem selectedItem;
private static boolean ageVerified = false; //static variable - once 1 order has been age verified, no longer require verification
public orderItem(menuItem m, int q){
selectedItem = m;
qty = q;
//somewhat of a dirty hack to get the float to 2 decimals, didn't want to convert to string here
//https://mkyong.com/java/how-to-round-double-float-value-to-2-decimal-points-in-java/#mathround
extPrice = Math.round(m.getItemPrice() * (double) qty * 100.0)/100.0;
}
public void verifyAge(boolean t){
ageVerified = t;
}
public menuItem getItem(){
return selectedItem;
}
public boolean isVerified(){
return ageVerified;
}
public double getExtPrice(){
return extPrice;
}
public String toString(){
return selectedItem.getItemDesc() + ", qty "+ qty + ", sub total $" + extPrice;
}
}//class