Source Code
import java.io.*;
class Shopping_Mall
{
public void display()throws IOException
{
BufferedReader r=new BufferedReader(new InputStreamReader(System.in));
String item[]={"Complan","Boost","Jelly","Chocolate Cream","Treat Biscuit", "Flavoured Milk",
"Pepsi", "Coca Cola", "Sprite", "Potato", "Tomato", "Onion", "Rice", "Ashirwad Atta", "Flour", "Corn
Flakes", "Mango Pickle", "Jam", "Maggi", "Chowmin", "Amul Butter", "Shirt", "Trouser", "Micro Oven",
"Induction Cooker", "Iron", "Bowl Set", "Cutlery Set", "Baby Washing Tub", "Baby Clothes", "Toys",
"Hair Oil", "Floor Cleaner", "Vacuum Cleaner", "Soap", "Handkerchief", "Powder", "Ornaments",
"Trolley Bags", "Footwear", "Air Conditioner", "Fan", "Papad", "Chocolate", "Body Lotion", "Shampoo",
"Deodorant", "Vest", "Sun Glasses", "Tiffin Box"};
int price[]={160,135,110,120,35,50,90,85,90,60,70,100,55,80,90,115,110,130,140,50,130, 1200,
1100,15000,2500,650,800,1350,450,600,250,95,140,3000,30,25,170,1500,4000,500,26000,2600,30,200,
370,150,230,125,2000,150};
String customer_name="";
long customer_phno=0L;
String choice_item="", ch="", choice="", items_ordered="";
int qty=0,srch_index=0, bill_no=5301;
double totamt=0.0, gst=0.0, grand_total=0.0;
boolean flag=true;
for(int i=0;i<50;i++)
{
int l=item[i].length();
for(int j=l;j<=25;j++)
{
item[i]+=" ";
}
}
do
{
System.out.println("\n\n\n\t\t\t\t\t :: You are welcome to this Shopping Plaza ::");
System.out.println("\t\t\t\t\t --------------------------------------\n");
System.out.println("\t======================================================
==\n");
System.out.println("\t\t\t\t\t\t\t B I G B A Z A R\n");
System.out.println("\t======================================================\
n\n");
System.out.println("\t\t\t\t\t\t\t Available Items");
System.out.println("\t\t\t\t\t\t\t ---------------\n");
System.out.println("\n\t\tItem Names\t\t\tPrice Per Unit\t\t\tItem Names\t\t\tPrice Per Unit\n");
System.out.println("\n\t\t----------\t\t\t--------------\t\t\t----------\t\t\t--------------\n");
for(int i=0;i<50;i++)
{
if(i%2==0)
System.out.println();
(2)
System.out.print("\t\t"+(i+1)+") "+item[i]+"\t = Rs. "+price[i]+"/-"+"\t");
}
System.out.println("\n\n\t====================================================
==\n");
System.out.println("\n\tEnter the customer's name : ");
System.out.print("\t");
customer_name=r.readLine();
System.out.println("\n\tEnter the customer's phone number : ");
System.out.print("\t");
customer_phno=Long.parseLong(r.readLine());
do
{
System.out.println("\n\tEnter the name of the item to be purchased : ");
System.out.print("\t");
choice_item=r.readLine();
for(int i=0;i<50;i++)
{
if(choice_item.equalsIgnoreCase(item[i].trim()))
{
srch_index=i;
flag=false;
break;
}
}
if(flag)
{
System.out.println("\n\tSorry, the item is not available.");
}
else
{
System.out.println("\n\tEnter the number of items to be purchased.");
System.out.print("\t");
qty=Integer.parseInt(r.readLine());
totamt+=price[srch_index]*qty;
items_ordered+=item[srch_index]+"Rs. "+price[srch_index]+"/-"+"\t X\t "+qty+"\t = Rs. " +
(price[srch_index]*qty)+"/-"+"\n\t\t\t\t";
}
System.out.println("\n\tIs there any more item to be purchased ? Type 'yes' to confirm.");
System.out.print("\t");
ch=r.readLine();
flag=true;
}
while(ch.equalsIgnoreCase("yes"));
gst=totamt*0.18;
grand_total=totamt+gst;
System.out.println("\n\n\t===================================================");
System.out.println("\n\t\t\t\t\t\t\t B I G B A Z A R");
System.out.println("\n\t======================================================");
System.out.println("\n\t\t\t\t\t\t\t\t\t\t Bill No. : "+bill_no);
(3)
System.out.println("\n\n\t\t\t\t\t\t\t BILL");
System.out.println("\t\t\t\t\t\t\t ====");
System.out.println("\n\t\t\t\tName of the Customer : "+customer_name);
System.out.println("\t\t\t\tPhone Number of the Customer : "+customer_phno);
System.out.println("\n\t\t\t\tItem\t\t\t Price\t\tQuantity\t Amount");
System.out.println("\t\t\t\t----\t\t\t -----\t\t--------\t ------");
System.out.println("\n\t\t\t\t"+items_ordered);
System.out.println("\t\t\t\t-------------------------------------------------------------------------");
System.out.println("\n\t\t\t\t\t\t\t Total amount = Rs. "+totamt+"/-");
System.out.println("\t\t\t\t\t\t\t G.S.T. @ 18 % = Rs. "+gst+"/-");
System.out.println("\t\t\t\t\t\t\t Grand Total = Rs. "+grand_total+"/-");
System.out.println("\t\t\t\t-------------------------------------------------------------------------");
System.out.println("\n\n\t\t\t\t\t\t "+"Thanks for visiting B I G B A Z A R");
System.out.println("\n\n\t=================================================");
System.out.println("\n\n\tIs there any customer ? Type 'yes' to confirm.");
System.out.print("\t");
choice = r.readLine();
bill_no++;
totamt=gst=grand_total=0.0;
items_ordered="";
}
while(choice.equalsIgnoreCase("yes"));
}
}
(4)
Inputs and Outputs
:: You are welcome to this Shopping Plaza ::
-------------------------------------------------
=====================================================================
BIG BAZAR
=====================================================================
Available Items
-------------------
Item Names Price Per Unit Item Names Price Per Unit
-------------- ----------------- -------------- -----------------
1) Complan = Rs. 160/- 2) Boost = Rs. 135/-
3) Jelly = Rs. 110/- 4) Chocolate Cream = Rs. 120/-
5) Treat Biscuit = Rs. 35/- 6) Flavoured Milk = Rs. 50/-
7) Pepsi = Rs. 90/- 8) Coca Cola = Rs. 85/-
9) Sprite = Rs. 90/- 10) Potato = Rs. 60/-
11) Tomato = Rs. 70/- 12) Onion = Rs. 100/-
13) Rice = Rs. 55/- 14) Ashirwad Atta = Rs. 80/-
15) Flour = Rs. 90/- 16) Corn Flakes = Rs. 115/-
17) Mango Pickle = Rs. 110/- 18) Jam = Rs. 130/-
19) Maggi = Rs. 140/- 20) Chowmin = Rs. 50/-
21) Amul Butter = Rs. 130/- 22) Shirt = Rs. 1200/-
23) Trouser = Rs. 1100/- 24) Micro Oven = Rs. 15000/-
25) Induction Cooker = Rs. 2500/- 26) Iron = Rs. 650/-
27) Bowl Set = Rs. 800/- 28) Cutlery Set = Rs. 1350/-
29) Baby Washing Tub = Rs. 450/- 30) Baby Clothes = Rs. 600/-
31) Toys = Rs. 250/- 32) Hair Oil = Rs. 95/-
33) Floor Cleaner = Rs. 140/- 34) Vacuum Cleaner = Rs. 3000/-
35) Soap = Rs. 30/- 36) Handkerchief = Rs. 25/-
37) Powder = Rs. 170/- 38) Ornaments = Rs. 1500/-
39) Trolley Bags = Rs. 4000/- 40) Footwear = Rs. 500/-
41) Air Conditioner = Rs. 26000/- 42) Fan = Rs. 2600/-
43) Papad = Rs. 30/- 44) Chocolate = Rs. 200/-
45) Body Lotion = Rs. 370/- 46) Shampoo = Rs. 150/-
47) Deodorant = Rs. 230/- 48) Vest = Rs. 125/-
49) Sun Glasses = Rs. 2000/- 50) Tiffin Box = Rs. 150/-
===========================================================================
Enter the customer's name :
Amit Mukherjee
Enter the customer's phone number :
8954632817
(5)
Enter the name of the item to be purchased :
Complan
Enter the number of items to be purchased.
2
Is there any more item to be purchased ? Type 'yes' to confirm.
yes
Enter the name of the item to be purchased :
Body Lotion
Enter the number of items to be purchased.
3
Is there any more item to be purchased ? Type 'yes' to confirm.
yes
Enter the name of the item to be purchased :
Maggi
Enter the number of items to be purchased.
6
Is there any more item to be purchased ? Type 'yes' to confirm.
yes
Enter the name of the item to be purchased :
Shampoo
Enter the number of items to be purchased.
3
Is there any more item to be purchased ? Type 'yes' to confirm.
no
(6)
==========================================================================
BIG BAZAR
==========================================================================
Bill No. : 5301
BILL
====
Name of the Customer : Amit Mukherjee
Phone Number of the Customer : 8954632817
Item Price Quantity Amount
------ ------ ---------- ---------
Complan Rs. 160/- X 2 = Rs. 320/-
Body Lotion Rs. 370/- X 3 = Rs. 1110/-
Maggi Rs. 140/- X 6 = Rs. 840/-
Shampoo Rs. 150/- X 3 = Rs. 450/-
-------------------------------------------------------------------------
Total amount = Rs. 2720.0/-
G.S.T. @ 18 % = Rs. 489.59999999999997/-
Grand Total = Rs. 3209.6/-
-------------------------------------------------------------------------
Thanks for visiting B I G B A Z A R
=====================================================================
Is there any customer ? Type 'yes' to confirm.
yes
(7)
:: You are welcome to this Shopping Plaza ::
-------------------------------------------------
=====================================================================
BIG BAZAR
=====================================================================
Available Items
-------------------
Item Names Price Per Unit Item Names Price Per Unit
-------------- ----------------- -------------- -----------------
1) Complan = Rs. 160/- 2) Boost = Rs. 135/-
3) Jelly = Rs. 110/- 4) Chocolate Cream = Rs. 120/-
5) Treat Biscuit = Rs. 35/- 6) Flavoured Milk = Rs. 50/-
7) Pepsi = Rs. 90/- 8) Coca Cola = Rs. 85/-
9) Sprite = Rs. 90/- 10) Potato = Rs. 60/-
11) Tomato = Rs. 70/- 12) Onion = Rs. 100/-
13) Rice = Rs. 55/- 14) Ashirwad Atta = Rs. 80/-
15) Flour = Rs. 90/- 16) Corn Flakes = Rs. 115/-
17) Mango Pickle = Rs. 110/- 18) Jam = Rs. 130/-
19) Maggi = Rs. 140/- 20) Chowmin = Rs. 50/-
21) Amul Butter = Rs. 130/- 22) Shirt = Rs. 1200/-
23) Trouser = Rs. 1100/- 24) Micro Oven = Rs. 15000/-
25) Induction Cooker = Rs. 2500/- 26) Iron = Rs. 650/-
27) Bowl Set = Rs. 800/- 28) Cutlery Set = Rs. 1350/-
29) Baby Washing Tub = Rs. 450/- 30) Baby Clothes = Rs. 600/-
31) Toys = Rs. 250/- 32) Hair Oil = Rs. 95/-
33) Floor Cleaner = Rs. 140/- 34) Vacuum Cleaner = Rs. 3000/-
35) Soap = Rs. 30/- 36) Handkerchief = Rs. 25/-
37) Powder = Rs. 170/- 38) Ornaments = Rs. 1500/-
39) Trolley Bags = Rs. 4000/- 40) Footwear = Rs. 500/-
41) Air Conditioner = Rs. 26000/- 42) Fan = Rs. 2600/-
43) Papad = Rs. 30/- 44) Chocolate = Rs. 200/-
45) Body Lotion = Rs. 370/- 46) Shampoo = Rs. 150/-
47) Deodorant = Rs. 230/- 48) Vest = Rs. 125/-
49) Sun Glasses = Rs. 2000/- 50) Tiffin Box = Rs. 150/-
===========================================================================
Enter the customer's name :
Kakali Chatterjee
Enter the customer's phone number :
9568432835
Enter the name of the item to be purchased :
Floor Cleaner
(8)
Enter the number of items to be purchased.
1
Is there any more item to be purchased ? Type 'yes' to confirm.
yes
Enter the name of the item to be purchased :
Deodorant
Enter the number of items to be purchased.
2
Is there any more item to be purchased ? Type 'yes' to confirm.
yes
Enter the name of the item to be purchased :
DVD
Sorry, the item is not available.
Is there any more item to be purchased ? Type 'yes' to confirm.
yes
Enter the name of the item to be purchased :
Pepsi
Enter the number of items to be purchased.
5
Is there any more item to be purchased ? Type 'yes' to confirm.
yes
Enter the name of the item to be purchased :
Amul Butter
Enter the number of items to be purchased.
2
Is there any more item to be purchased ? Type 'yes' to confirm.
yes
Enter the name of the item to be purchased :
Jam
Enter the number of items to be purchased.
3
Is there any more item to be purchased ? Type 'yes' to confirm.
no
(9)
==========================================================================
BIG BAZAR
==========================================================================
Bill No. : 5302
BILL
====
Name of the Customer : Kakali Chatterjee
Phone Number of the Customer : 9568432835
Item Price Quantity Amount
------ ------ ----------- ----------
Floor Cleaner Rs. 140/- X 1 = Rs. 140/-
Deodorant Rs. 230/- X 2 = Rs. 460/-
Pepsi Rs. 90/- X 5 = Rs. 450/-
Amul Butter Rs. 130/- X 2 = Rs. 260/-
Jam Rs. 130/- X 3 = Rs. 390/-
-------------------------------------------------------------------------
Total amount = Rs. 1700.0/-
G.S.T. @ 18 % = Rs. 306.0/-
Grand Total = Rs. 2006.0/-
-------------------------------------------------------------------------
Thanks for visiting B I G B A Z A R
=====================================================================
Is there any customer ? Type 'yes' to confirm.
no
:: ==== ::