-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPizzaOrderingSystem.java
221 lines (194 loc) · 4.59 KB
/
PizzaOrderingSystem.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
import java.util.*;
class PizzaOrderingSystem
{
public static void main(String[] args)
{
int opt;
//Vegetarian Pizza Object's
VegPizza v=new VegPizza();
PeppyPaneer vp=new PeppyPaneer();
MexicanGreenWave vm=new MexicanGreenWave();
DeluxeVeggie vd=new DeluxeVeggie();
//Non-Vegetarian Pizza Object's
NonVegPizza nv=new NonVegPizza();
ChickenGoldenDelight nvc=new ChickenGoldenDelight();
NonVegSupreme nvnv=new NonVegSupreme();
PepperBarbecueOnion nvpb=new PepperBarbecueOnion();
Scanner sc=new Scanner(System.in);
System.out.println("We offer different varieties of veg and non-veg pizza");
System.out.println("Enter: \nV to explore veg \nNV to explore Non-Veg");
String s=sc.next();
if(s.equalsIgnoreCase("v"))
{
ChooseVegPizza cv=new ChooseVegPizza();
System.out.println("Veg Menu: \n1.PeppyPaneer \n2.MexicanGreenWave \n3.DeluxeVeggie");
opt=sc.nextInt();
switch(opt)
{
case 1:cv.selectYourFavouritePizza(vp);
break;
case 2:cv.selectYourFavouritePizza(vm);
break;
case 3:cv.selectYourFavouritePizza(vd);
break;
default:System.out.println("No such variety available");
break;
}
}
else if(s.equalsIgnoreCase("nv"))
{
ChooseNonVegPizza cnv=new ChooseNonVegPizza();
System.out.println("Non Veg Menu: \n1.ChickenGoldenDelight \n2.NonVegSupreme \n3.PepperBarbecueOnion");
opt=sc.nextInt();
switch(opt)
{
case 1:cnv.selectYourFavouritePizza(nvc);
break;
case 2:cnv.selectYourFavouritePizza(nvnv);
break;
case 3:cnv.selectYourFavouritePizza(nvpb);
break;
default:System.out.println("No such variety available");
break;
}
}
}
}
class ChooseVegPizza
{
public void selectYourFavouritePizza(VegPizza ref)
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter Quantity");
int num=sc.nextInt();
ref.addQuantity(num);
ref.cost();
}
}
class ChooseNonVegPizza
{
public void selectYourFavouritePizza(NonVegPizza ref)
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter Quantity");
int num=sc.nextInt();
ref.addQuantity(num);
ref.cost();
}
}
class VegPizza
{
int Qty=0;
int rate;
void VegPizza()
{
System.out.println("A delight for veggie lovers! Choose from our wide range of delicious vegetarian pizzas,it's softer and tastier");
}
public void addQuantity(int num)
{
Qty+=num;
System.out.println("Quantity= "+Qty+"No.s");
}
public void cost()
{
rate*=Qty;
System.out.println("Cost=Rs."+rate);
}
}
class PeppyPaneer extends VegPizza
{
int rate=150;
PeppyPaneer()
{
System.out.println("Soft Paneer and Hot Pepper Combo-Rs 150/Piece PeppyPaneer");
}
public void cost()
{
rate*=Qty;
System.out.println("Cost=Rs."+rate);
}
}
class MexicanGreenWave extends VegPizza
{
int rate=175;
MexicanGreenWave()
{
System.out.println("Sweet and spicy mexican combo-Rs 175/Piece MexicanGreenWave");
}
public void cost()
{
rate*=Qty;
System.out.println("Cost=Rs."+rate);
}
}
class DeluxeVeggie extends VegPizza
{
int rate=200;
DeluxeVeggie()
{
System.out.println("High quality veggie treat-Rs 200/Piece DeluxeVeggie");
}
public void cost()
{
rate*=Qty;
System.out.println("Cost=Rs."+rate);
}
}
class NonVegPizza
{
int Qty=0;
int rate;
void NonVegPizza()
{
System.out.println("Non-Veg pizza's high on crusts and toppings");
}
public void addQuantity(int num)
{
Qty+=num;
System.out.println("Quantity= "+Qty+"No.s");
}
public void cost()
{
rate*=Qty;
System.out.println("Cost=Rs."+rate);
}
}
class ChickenGoldenDelight extends NonVegPizza
{
int rate=250;
ChickenGoldenDelight()
{
System.out.println("Fried Chicken-Rs 250/Piece ChickenGoldenDelight");
}
public void cost()
{
rate*=Qty;
System.out.println("Cost=Rs."+rate);
}
}
class NonVegSupreme extends NonVegPizza
{
int rate=285;
NonVegSupreme()
{
System.out.println("Mixture high on chicken added veggies-Rs 285/Piece NonVegSupreme");
}
public void cost()
{
rate*=Qty;
System.out.println("Cost=Rs."+rate);
}
}
class PepperBarbecueOnion extends NonVegPizza
{
int rate=325;
PepperBarbecueOnion()
{
System.out.println("Grilled chicken added with onion carvings-Rs 325/Piece PepperBarbecueOnion");
}
public void cost()
{
rate*=Qty;
System.out.println("Cost=Rs."+rate);
}
}