-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenuItem.java
More file actions
57 lines (45 loc) · 1 KB
/
MenuItem.java
File metadata and controls
57 lines (45 loc) · 1 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
public abstract class MenuItem{
private String name;
private double price;
private String orderCode;
// constructor for the parent class MenuItem
public MenuItem(){
name = "default name";
price = 0.00;
orderCode = "default code";
}
// constructor to pass on to child classes
public MenuItem( String name, double price, String orderCode ){
this.name = name;
this.price = price;
this.orderCode = orderCode;
}
// name getter
public String getName(){
return name;
}
// name setter
public void setName( String name ){
this.name = name;
}
// price getter
public double getPrice(){
return price;
}
// price setter
public void setPrice( double price ){
this.price = price;
}
// orderCode getter
public String getCode(){
return orderCode;
}
// orderCode setter
public void setCode( String orderCode ){
this.orderCode = orderCode;
}
// toString to pass to child classes
public String toString(){
return orderCode + " : " + name + " Price: $" + price;
}
}