forked from Adityaranjanpatra/Btecky2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GROCERY MANAGEMENT SYSTEM IN JAVA
260 lines (251 loc) · 13.8 KB
/
GROCERY MANAGEMENT SYSTEM IN 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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
import java.util.*;
public class Grocery {
static Grocery g = new Grocery();
Scanner sc = new Scanner(System.in);
void start() {
System.out.println("");
System.out.println("Now select what item you want to buy :\n1. Tea 2. Coffee 3. Rava\n4. Flour 5. Sugar
6.Salt\n");
System.out.println("-----------------------------------------------------------------------------------------");
System.out.println("");
System.out.print("Your choice --> ");
int ch = sc.nextInt();
System.out.println("");
System.out.println("-----------------------------------------------------------------------------------------");
System.out.println("");
switch (ch) {
case 1:
System.out.println("Select what Tea brand you want :\n1.Wagh Bakri 1kg 2.Lipton 1kg 3.Red Label 1kg 4.Taj
Mahal 1kg 5.Changed my mind");
System.out.println("");
System.out.println(".........................................................................................");
System.out.print("Your choice --> ");
int brand = sc.nextInt();
System.out.println("");
System.out.println("");
System.out.println("---------------------------------------------------------------------------------------");
if (brand == 1) {
System.out.println("You chose 'Wagh Bakri' Tea\n.....................................................................................\nYour bill is
500rs");
System.out.println(".........................................................................................");
} else if (brand == 2) {
System.out.println("You chose 'Lipton' Tea\n.........................................................................................\nYour bill is
490rs");
System.out.println(".........................................................................................");
} else if (brand == 3) {
System.out.println("You chose 'Red Label' Tea\n.........................................................................................\nYour bill is
450");
System.out.println(".........................................................................................");
} else if (brand == 4) {
System.out.println("You chose 'Taj Mahal' Tea\n........................................................................................\nYour bill is
550rs");
System.out.println(".........................................................................................");
} else {
System.out.println("Press '0' to return to item list");
int r1 = sc.nextInt();
if (r1 == 0) {
g.start();
}
}
break;
case 2:
System.out.println("Select what Coffee brand you want :\n1.Bru 1kg 2.NesCafe 1kg 3.Bevzilla 1kg 4.Range 1kg
5.Changed my mind");
System.out.println("");
System.out.println(".........................................................................................");
System.out.print("Your choice --> ");
int brand1 = sc.nextInt();
System.out.println("");
System.out.println("-----------------------------------------------------------------------------------------");
if (brand1 == 1) {
System.out.println("You chose 'Bru' Coffee\n.........................................................................................\nYour bill is
475rs");
System.out.println(".........................................................................................");
} else if (brand1 == 2) {
System.out.println("You chose 'NesCafe' Coffee\n.........................................................................................\nYour bill is
599rs");
System.out.println(".........................................................................................");
} else if (brand1 == 3) {
System.out.println("You chose 'Bevzilla' Coffee\n.........................................................................................\nYour bill is
850rs");
System.out.println(".........................................................................................");
} else if (brand1 == 4) {
System.out.println("You chose 'Range' Coffee\n.........................................................................................\nYour bill is
699rs");
System.out.println(".........................................................................................");
} else {
System.out.println("Press '0' to return to item list");
int r1 = sc.nextInt();
if (r1 == 0) {
g.start();
}
}
break;
case 3:
System.out.println("Select what Rava brand you want :\n1. Suzi 1kg 2.Royal 1kg 3.Bombay 1kg 4.Pranav 1kg
5.Changed my mind");
System.out.println("");
System.out.println(".........................................................................................");
System.out.print("Your choice --> ");
int brand2 = sc.nextInt();
System.out.println("");
System.out.println("-----------------------------------------------------------------------------------------");
if (brand2 == 1) {
System.out.println("You chose 'Suzi' Rava\n.........................................................................................\nYour bill is
50rs");
System.out.println(".........................................................................................");
} else if (brand2 == 2) {
System.out.println("You chose 'Royal' Rava\n.........................................................................................\nYour bill is
100rs");
System.out.println(".........................................................................................");
} else if (brand2 == 3) {
System.out.println("You chose 'Bombay' Rava\n.........................................................................................\nYour bill is
60rs");
System.out.println(".........................................................................................");
} else if (brand2 == 4) {
System.out.println("You chose 'Pranav' Rava\n.........................................................................................\nYour bill is
10rs");
System.out.println(".........................................................................................");
} else {
System.out.println("Press '0' to return to item list");
int r1 = sc.nextInt();
if (r1 == 0) {
g.start();
}
}
break;
case 4:
System.out.println("Select what Flour brand you want :\n1.Aashirvaad 10kg 2.Chakki 10kg 3.Fortune 10kg
4.Amul 10kg 5.Changed my mind");
System.out.println("");
System.out.println(".........................................................................................");
System.out.print("Your choice --> ");
int brand3 = sc.nextInt();
System.out.println("");
System.out.println("-----------------------------------------------------------------------------------------");
if (brand3 == 1) {
System.out.println("You chose 'Aashirvaad' Flour\n.........................................................................................\nYour bill
is 450rs");
System.out.println("........................................................................................");
} else if (brand3 == 2) {
System.out.println("You chose 'Chakki' Flour\n........................................................................................\nYour bill is
300rs");
System.out.println("........................................................................................");
} else if (brand3 == 3) {
System.out.println("You chose 'Fortune' Flour\n........................................................................................\nYour bill is
400rs");
System.out.println("........................................................................................");
} else if (brand3 == 4) {
System.out.println("You chose 'Amul' Flour\n........................................................................................\nYour bill is
400rs");
System.out.println("........................................................................................");
} else {
System.out.println("Press '0' to return to item list");
int r1 = sc.nextInt();
if (r1 == 0) {
g.start();
}
}
break;
case 5:
System.out.println("Select what Sugar brand you want :\n1.Madhur 10kg 2.White Label 10kg 3.Mantra 10kg
4.Royal 10kg 5.Changed my mind");
System.out.println("");
System.out.println("........................................................................................");
System.out.print("Your choice --> ");
int brand4 = sc.nextInt();
System.out.println("");
System.out.println("-----------------------------------------------------------------------------------------");
if (brand4 == 1) {
System.out.println("You chose 'Madhur' Sugar\n........................................................................................\nYour bill is
500rs");
System.out.println("........................................................................................");
} else if (brand4 == 2) {
System.out.println("You chose 'White Label' Sugar\n........................................................................................\nYour bill
is 450rs");
System.out.println("........................................................................................");
} else if (brand4 == 3) {
System.out.println("You chose 'Mantra' Sugar\n........................................................................................\nYour bill is
400rs");
System.out.println("........................................................................................");
} else if (brand4 == 4) {
System.out.println("You chose 'Royal' Sugar\n........................................................................................\nYour bill is
550rs");
System.out.println("........................................................................................");
} else {
System.out.println("Press '0' to return to item list");
int r1 = sc.nextInt();
if (r1 == 0) {
g.start();
}
}
break;
case 6:
System.out.println("Select what Salt brand you want :\n1.Tata 1kg 2.Aashirvaad 1kg 3.Royal 1kg 4.Puro 1kg
5.Changed my mind");
System.out.println("");
System.out.println("........................................................................................");
System.out.print("Your choice --> ");
int brand5 = sc.nextInt();
System.out.println("");
System.out.println("-----------------------------------------------------------------------------------------");
if (brand5 == 1) {
System.out.println("You chose 'Tata' Salt\n........................................................................................\nYour bill is 25rs");
System.out.println("........................................................................................");
} else if (brand5 == 2) {
System.out.println("You chose 'Aashirvaad' Salt\n........................................................................................\nYour bill is
20rs");
System.out.println("........................................................................................");
} else if (brand5 == 3) {
System.out.println("You chose 'Royal' Salt\n........................................................................................\nYour bill is
50rs");
System.out.println("........................................................................................");
} else if (brand5 == 4) {
System.out.println("You chose 'Puro' Salt\n........................................................................................\nYour bill is 60rs");
System.out.println(".........................................................................................");
} else {
System.out.println("Press '0' to return to item list");
int r1 = sc.nextInt();
if (r1 == 0) {
g.start();
}
}
break;
}
}
void end() {
System.out.println("If you want to buy another item then press 1 else press 2");
int press=sc.nextInt();
if(press==1){
g.start();}
else if(press==2)
{
/*System.out.println("If you want to buy an new item type 'again' else say 'bye' and leave");
String again = sc.next();
String a = sc.next();
if (again == again) {
g.start();
}
else if (a == "bye") {
*/
System.out.println("-----------------------------------------------------------------------------------------");
System.out.println("");
System.out.println("Thank you pls visit us again <3");
System.out.println("");
System.out.println(".........................................................................................");
}
}
public static void main (String[]args)
{
System.out.println(".........................................................................................");
System.out.println("");
System.out.println("\t SALLU GROCERY STORES");
System.out.println("");
System.out.println(".........................................................................................");
System.out.println("!!!------------------------------Welcome to Sallu Market-------------------------------!!!");
System.out.println(".........................................................................................");
System.out.println("");
g.start();
g.end();
}
}