Shopping Mall Bill
Shopping Mall Bill
import java.util.*;
class Shopping_Bill
{
public void main()
{
String name="", itemname="";
long number=0;
int itn=0,n=0,i=0;
double amt,qty,totamt=0.0,famt=0.0;
Scanner sc= new Scanner(System.in);
System.out.println("
~~~~~~'ARCAZE GROCERY SHOPPING MALL'~~~~~~------------------------
");
System.out.println("");
System.out.println("Please enter your name: ");
name=sc.nextLine();
System.out.println("Please enter your phone number: ");
number=sc.nextLong();
System.out.println("
~~~~~~'WELCOME'~~~~~~
");
System.out.println("");
System.out.println("Please enter the number of items you want
to purchase: ");
n=sc.nextInt();
System.out.println("");
System.out.println("GOODS"+"\t\t\t\t\t\t\t\t\t"+"PRICE(in Rs)");
System.out.println("1. Darjeeling Tea"+"\t\t\t\t\t\t\t"+"Rs 30
per kg");
System.out.println("2. Premium Coffee"+"\t\t\t\t\t\t\t"+"Rs 45
per kg");
System.out.println("3. Packaged Honey Jar"+"\t\t\t\t\t\t\t"+"Rs
35 per unit");
System.out.println("4. All Purpose
Flour(Maida)"+"\t\t\t\t\t\t"+"Rs 20 per kg");
System.out.println("5. Wheat Flour(Aata)"+"\t\t\t\t\t\t\t"+"Rs
14 per kg");
System.out.println("6. Mixed Lentils"+"\t\t\t\t\t\t\t"+"Rs 25 per
kg");
System.out.println("7. Sugar"+"\t\t\t\t\t\t\t\t"+"Rs 15 per kg");
System.out.println("8. Packaged Salt Packs"+"\t\t\t\t\t\t\t"+"Rs
55 per unit");
System.out.println("9. Biscuit Packs"+"\t\t\t\t\t\t\t"+"Rs 26 per
unit");
System.out.println("10.Condiments Packs(Chips/Namkeen)"+"\t\
t\t\t\t"+"Rs 25 per unit");
System.out.println("");
for(i=1;i<=n;i++)
{
System.out.println("Please select the item's/items' number
that you would like to purchase from the list above: (For
example: Enter 1 for buying Tea)");
itn=sc.nextInt();
qty=0.0;
amt=0.0;
switch(itn)
{
case 1:
System.out.println("Enter the quantity of tea you want (in
kgs): ");
qty=sc.nextDouble();
amt=30*qty;
totamt=totamt+amt;
itemname=itemname+"Darjeeling Tea"+" "+" ";
System.out.println("Total cost of purchasing "+qty+" kgs of
tea (excluding tax): Rs "+amt);
System.out.println("");
break;
case 2:
System.out.println("Enter the quantity of coffee you want
(in kgs): ");
qty=sc.nextDouble();
amt=45*qty;
totamt=totamt+amt;
itemname=itemname+"Premium Coffee"+" "+" ";
System.out.println("Total cost of purchasing "+qty+" kgs of
coffee (excluding tax): Rs "+amt);
System.out.println("");
break;
case 3:
System.out.println("Enter the number of honey jars you
want: ");
qty=sc.nextDouble();
amt=qty*35;
totamt=totamt+amt;
itemname=itemname+"Packaged Honey Jar"+" "+" ";
System.out.println("Total cost of purchasing "+qty+"
number of honey jars (excluding tax): Rs "+amt);
System.out.println("");
break;
case 4:
System.out.println("Enter the quantity of All Purpose
Flour(Maida) you want (in kgs): ");
qty=sc.nextDouble();
amt=qty*20;
totamt=totamt+amt;
itemname=itemname+"All Purpose Flour(Maida)"+" "+" ";
System.out.println("Total cost of purchasing "+qty+" kgs of
Maida (excluding tax): Rs "+amt);
System.out.println("");
break;
case 5:
System.out.println("Enter the quantity of Wheat Flour(Aata)
(in kgs) you want: ");
qty=sc.nextDouble();
amt=qty*14;
totamt=totamt+amt;
itemname=itemname+"Wheat Flour(Aata)"+" "+" ";
System.out.println("Total cost of purchasing "+qty+" kgs of
Aata (excluding tax): Rs "+amt);
System.out.println("");
break;
case 6:
System.out.println("Enter the quantity of mixed lentils you
want (in kgs): ");
qty=sc.nextDouble();
amt=qty*25;
totamt=totamt+amt;
itemname=itemname+"Mixed Lentils"+" "+" ";
System.out.println("Total cost of purchasing "+qty+" kgs of
mixed lentils (excluding tax): Rs "+amt);
System.out.println("");
break;
case 7:
System.out.println("Enter the quantity of sugar you want (in
kgs): ");
qty=sc.nextDouble();
amt=qty*15;
totamt=totamt+amt;
itemname=itemname+"Sugar"+" "+" ";
System.out.println("Total cost of purchasing "+qty+" kgs of
sugar (excluding tax): Rs "+amt);
System.out.println("");
break;
case 8:
System.out.println("Enter the number of packaged salt
packs you want: ");
qty=sc.nextDouble();
amt=qty*55;
totamt=totamt+amt;
itemname=itemname+"Packaged Salt Packs"+" "+" ";
System.out.println("Total cost of purchasing "+qty+"
number of packaged salt packs (excluding tax): Rs "+amt);
System.out.println("");
break;
case 9:
System.out.println("Enter the number of biscuit packs you
want: ");
qty=sc.nextDouble();
amt=qty*26;
totamt=totamt+amt;
itemname=itemname+"Biscuit Packs"+" ";
System.out.println("Total cost of purchasing "+qty+"
number of biscuit packs (excluding tax): Rs "+amt);
System.out.println("");
break;
case 10:
System.out.println("Enter the number of condiments packs
you want: ");
qty=sc.nextDouble();
amt=qty*25;
totamt=totamt+amt;
itemname=itemname+"Condiment Packs"+" "+" ";
System.out.println("Total cost of purchasing "+qty+"
number of condiments packs (excluding tax): Rs "+amt);
System.out.println("");
break;
default:
System.out.println("Invalid Choice.Item number not present
in the list above. Please try again from the first.");
System.exit(0);
}
}
famt=totamt+(0.05*totamt);
System.out.println("");
System.out.println("
~~~~~~'BILL'~~~~~~
");
System.out.println("");
System.out.println("Costumer name: "+name);
System.out.println("Phone number of costumer: "+number);
System.out.println("Number of items purchased: "+n);
System.out.println("Items purchased: "+itemname);
System.out.println("");
System.out.println("Tax levied: 5%");
System.out.println("Total amount to be paid (including tax): Rs
"+famt);
System.out.println("");
System.out.println("
-~~~~~~'THANK YOU FOR SHOPPING'~~~~~~---------------------------------
");
}
}