-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenuItems.java
128 lines (111 loc) · 2.62 KB
/
MenuItems.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import java.io.Serializable;
/**
*
* This class is the basic/template class on which MenuItems such as
* MainCourse/Dessert/Drink/Package are created
*
* @author JKF
*/
public class MenuItems implements Serializable, Comparable<MenuItems> {
/**
* long serialVersionUID allows for the serialization
*/
private static final long serialVersionUID = 1L;
/**
* String name - is the name of the MenuItems
*/
protected String name;
/**
* double price - is the price of the MenuItems
*/
protected double price;
/**
* String Description - is the description of the MenuItems
*/
protected String description;
/**
* String type - is the type of MenuItems ie MainCourse,Drinks,Desserts,APackage
*/
protected String type;
/**
* Default Constructor
*/
public MenuItems() {
super();
}
/**
* Constructor class
*
* @param name set name for the MenuItem
* @param price sets price for the MenuItem
* @param description sets description for the MenuItem
*/
public MenuItems(String name, double price, String description) {
this.name = name;
this.price = price;
this.description = description;
this.type = "MenuItems";
}
/**
* @return returns the name
*/
public String getName() {
return name;
}
/**
* @param name sets name for MenuItems
*/
public void setName(String name) {
this.name = name;
}
/**
* @return return the price
*/
public double getPrice() {
return price;
}
/**
*
* @param price sets price for the MenuItems
*/
public void setPrice(double price) {
this.price = price;
}
/**
*
* @return returns the Description
*/
public String getDescription() {
return description;
}
/**
*
* @param description sets description for the MenuItems
*/
public void setDescription(String description) {
this.description = description;
}
/**
*
* @return the type of the MenuItem (when it is called by the sub classes the
* type gets converted to suit the respective class that calls it eg
* when MainCourse class calls it the type gets converted as
* "MainCourse")
*/
public String getType() {
return type;
}
/**
* this method compares with other MenuItems Object
*/
public int compareTo(MenuItems M) {
return this.getType().compareTo(M.getType());
}
/**
* This method prints the details of this MenuItem object
*/
public void print() {
System.out.println(this.name + "\t" + this.price + "\t" + this.description + "\t" + this.type);
System.out.println();
}
}