-
Notifications
You must be signed in to change notification settings - Fork 0
/
bigbazar.java
473 lines (455 loc) · 19.5 KB
/
bigbazar.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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
import java.io.*;
public class bigbazar
{
public static void main(String args[])throws IOExceptionmd
{
InputStreamReader read = new InputStreamReader(System.in);
BufferedReader in= new BufferedReader(read);
int pp=0,i1,ch,ch1=0,num=0;
int rate[]=new int[100];
int amount[]=new int[100];
int quantity[]=new int[100];
String item[]=new String[100];
String name1,date,add;
System.out.println("welcome to bigbaazar");
System.out.println("Enter the name of Customer");
name1=in.readLine();
System.out.println("Enter the date in this formate '14/12/1996'");
date=in.readLine();
System.out.println("Enter the Address ");
add=in.readLine();
while(true)
{
System.out.println("1 for mobile");
System.out.println("2 for tablet pc");
System.out.println("3 for desktop");
System.out.println("4 for monitor ");
System.out.println("5 for usb modem");
System.out.println("6 for quit");
ch=Integer.parseInt(in.readLine());
if(ch==1)
{
while(true)
{
System.out.println("1-samsung s2 ,Rs:-22000");
System.out.println("2-Nokia lumia 920,Rs:-25000");
System.out.println("3-Sony Xperia Z,Rs:-45000");
System.out.println("4-Spice Coolpad MI-515,Rs-9500");
System.out.println("5-lenevo Thinkpad,Rs-38000");
System.out.println("6 for quit");
ch1=Integer.parseInt(in.readLine());
if(ch1==1)
{
item[pp]="samsung s2 ";
rate[pp]=22000;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==2)
{
item[pp]="Nokia lumia 920 ";
rate[pp]=25000;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==3)
{
item[pp]="Sony Xperia Z ";
rate[pp]=45000;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==4)
{
item[pp]="Spice Coolpad MI-515 ";
rate[pp]=9500;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==5)
{
item[pp]="lenevo Thinkpad ";
rate[pp]=38000;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==6)
{
break;
}
}
}
if(ch==2)
{
while(true)
{
System.out.println("1-samsung s Tablet ,Rs:-32500");
System.out.println("2-Bsnl Pneta ,Rs:-2500");
System.out.println("3-Sony Xperia Z tablet,Rs:-40000");
System.out.println("4-Akash 7+ Tablet,Rs-6500");
System.out.println("5-lenevo Thinkpad tablet,Rs-8000");
System.out.println("6 for quit");
ch1=Integer.parseInt(in.readLine());
if(ch1==1)
{
item[pp]="samsung s Tablet ";
rate[pp]=35000;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==2)
{
item[pp]="Bsnl Pneta ";
rate[pp]=2500;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==3)
{
item[pp]="Sony Xperia Z Tablet ";
rate[pp]=40000;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==4)
{
item[pp]="Akash 7+ Tablet ";
rate[pp]=6500;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==5)
{
item[pp]="lenevo Thinkpad Tablet ";
rate[pp]=8000;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==6)
{
break;
}
}
}
if(ch==3)
{
while(true)
{
System.out.println("1-Dell Inspiron x23 ,Rs:-32500");
System.out.println("2-HP envy windows@8 ,Rs:-45000");
System.out.println("3-Toshiba thunder bolt,Rs:-65000");
System.out.println("4-Apple mac book ,Rs-11500");
System.out.println("5-Asus gaming zone 65,Rs-78000");
System.out.println("6 for quit");
ch1=Integer.parseInt(in.readLine());
if(ch1==1)
{
item[pp]="Dell Inspiron x23 ";
rate[pp]=32500;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==2)
{
item[pp]="HP envy windows@8 ";
rate[pp]=45000;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==3)
{
item[pp]="Toshiba thunder bolt ";
rate[pp]=65000;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==4)
{
item[pp]="Apple mac book ";
rate[pp]=11500;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==5)
{
item[pp]="Asus gaming zone 65 ";
rate[pp]=78000;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==6)
{
break;
}
}
}
if(ch==4)
{
while(true)
{
System.out.println("1-Dell 14`inch ,Rs:-6500");
System.out.println("2-HP 21`inch ,Rs:-9500");
System.out.println("3-Toshiba 32`inch,Rs:-15000");
System.out.println("4-Apple 32`inch ,Rs-31500");
System.out.println("5-Asus 19`inch,Rs-8000");
System.out.println("6 for quit");
ch1=Integer.parseInt(in.readLine());
if(ch1==1)
{
item[pp]="Dell 14`inch ";
rate[pp]=6500;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==2)
{
item[pp]="HP 21`inch ";
rate[pp]=9500;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==3)
{
item[pp]="Toshiba 32`inch ";
rate[pp]=15000;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==4)
{
item[pp]="Apple 32`inch ";
rate[pp]=31500;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==5)
{
item[pp]="Asus 19`inch ";
rate[pp]=8000;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==6)
{
break;
}
}
}
if(ch==5)
{
while(true)
{
System.out.println("1-D-link Router 605 ,Rs:-1500");
System.out.println("2-TP-Link ,Rs:-900");
System.out.println("3-Micromax 3G Router,Rs:-5000");
System.out.println("4-Edimaxx 9Dbi Antena Router ,Rs-1800");
System.out.println("5-Tata photon 3G usb modem,Rs-1250");
System.out.println("6 for quit");
ch1=Integer.parseInt(in.readLine());
if(ch1==1)
{
item[pp]="D-link Router 605 ";
rate[pp]=1500;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==2)
{
item[pp]="TP-Link ";
rate[pp]=900;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==3)
{
item[pp]="Micromax 3G Router ";
rate[pp]=5000;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==4)
{
item[pp]="Edimaxx 9Dbi Antena Router ";
rate[pp]=1800;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==5)
{
item[pp]="Tata photon 3G usb modem ";
rate[pp]=1250;
System.out.println("enter the Quantity");
quantity[pp]=Integer.parseInt(in.readLine());
amount[pp]=rate[pp]*quantity[pp];
num=num+amount[pp];
pp++;
}
if(ch1==6)
{
break;
}
}
}
if(ch==6)
{
System.out.println("thank you");
break;
}
}
System.out.print('\u000c');
System.out.println("****************************BIGBAZAAR******************************************");
System.out.println(" Computer Generated Invoice ");
System.out.println(" Name of Customer is "+name1 );
System.out.println(" Date of Buying is "+date );
System.out.println(" Address of customer is "+add );
System.out.println("Sno"+'\t'+"item "+'\t'+"rate"+'\t'+"quantity"+'\t'+"amount");
for(i1=0;i1<pp;i1++)
{
System.out.println((i1+1)+" "+item[i1]+'\t'+rate[i1]+'\t'+quantity[i1]+'\t'+'\t'+amount[i1]);
}
System.out.println("Total amount is "+num);
String a[]={"","one","two","three","four","five","six","seven","eight","nine","ten","eleven","tweleve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty","twentyone","twentytwo","twentythree","twentyfour","twentyfive","twentysix","twentyseven","twentyeight","twentynine","thirty","thirtyone","thirtytwo","thirtythree","thirtyfour","thirtyfive","thirtysix","thirtyseven","thirtyeight","thirtynine","fourty","fourtyone","fourtytwo","fourtythree","fourtyfour","fourtyfive","fourtysix","fourtyseven","fourtyeight","fourtynine","fifty","fiftyone","fiftytwo","fiftythree","fiftyfour","fiftyfive","fiftysix","fiftyseven","fiftyeight","fiftynine","sixty","sixtyone","sixtytwo","sixtythree","sixtyfour","sixtyfive","sixtysix","sixtyseven","sixtyeight","sixtynine","seventy","seventyone","seventytwo","seventythree","seventyfour","seventyfive","seventysix","seventyseven","seventyeight","seventynine","eighty","eightyone","eightytwo","eightythree","eightyfour","eightyfive","eightysix","eightyseven","eightyeight","eightynine","ninty","nintyone","nintytwo","nintythree","nintyfour","nintyfive","nintysix","nintyseven","nintyeight","nintynine"};
int l,p1,p2,p3,i,p;
String str="";
String name=num+"";
l=name.length();
if(l==4||l==5)
{
p1=num/1000;
for(i=0;i<100;i++)
{
if(i==p1&&p1!=0)
{
str=str+a[i]+" thousand";
}
}
p2=(num%1000)/100;
for(i=0;i<100;i++)
{
if(i==p2&&p2!=0)
{
str=str+" "+a[i]+" hundred";
}
}
p3=(num%1000)%100;
for(i=0;i<100;i++)
{
if(i==p3&&p3!=0)
{
str=str+" and "+a[i]+" only";
}
}
}
if(l==6||l==7)
{
p=num/100000;
for(i=0;i<100;i++)
{
if(i==p&&p!=0)
{
str=str+a[i]+" lac";
}
}
p1=num%100000;
p1=p1/1000;
for(i=0;i<100;i++)
{
if(i==p1&&p1!=0)
{
str=str+" "+a[i]+" thousand";
}
}
p2=(num%1000)/100;
for(i=0;i<100;i++)
{
if(i==p2&&p2!=0)
{
str=str+" "+a[i]+" hundred";
}
}
p3=(num%1000)%100;
for(i=0;i<100;i++)
{
if(i==p3&&p3!=0)
{
str=str+" and "+a[i];
}
}
}
System.out.println("Amount in word:-");
System.out.println(str+" only");
System.out.println("****************************THANK YOU VISIT AGAIN********************************");
}
}