import java.util.*;


public class Bill3
{
public void time()
{
int day, month, year;
int minute, hour;
GregorianCalendar date = new GregorianCalendar();

day = date.get(Calendar.DAY_OF_MONTH);
month = date.get(Calendar.MONTH);
year = date.get(Calendar.YEAR);


minute = date.get(Calendar.MINUTE);
hour = date.get(Calendar.HOUR);

System.out.println("Date: "+day+"/"+(month+1)+"/"+year + "\t\t\t\t\tTime: "+hour+" : "+minute);
System.out.println();
}

public void Menu()
{
System.out.println("\n\n\nItems Available:- \n1. Wheat --------- a]Lokuean---Rs.70/kg \n\t\t b]Sharbati---Rs.100/kg ");
System.out.println("2. Rice ---------- a]Basmati---Rs125/kg \n\t\t b]Biryani---Rs.160/kg");
System.out.println("4. Tea Leaves ---- a]Green Tea---Rs.45 \n\t\t b]Black Tea---70");
System.out.println("3. Oil ----------- a]Groundnut---Rs80/li \n\t\t b]Soyabean---Rs100/li ");
System.out.println("7. Dal ----------- a]Tuhar Dal---Rs40/kg \n\t\t b]Moong Dal---Rs60/kg ");
}
public static void main(String arg[])
{

Scanner sc=new Scanner(System.in);
Bill2 obj=new Bill2();
String ch=" ";
String item[]= new String[100];
float quant[]= new float[100];
float cost[]=new float[100];
float total=0;
String check=" ";

System.out.println("\n\t\t*******Welcome to XYZ Supermarket*******");

int i=0, count=0;
while(check!="Bill")
{
ch=null;
obj.Menu();
System.out.println("\nEnter your " + (i+1) +" item and enter Bill in order to get the bill");
ch=sc.nextLine();

switch(ch)
{
case "Lokuean" :
System.out.println("Enter the quantity");
quant[i]=sc.nextInt();
item[i]=ch;
cost[i]= quant[i]*70.0f;
count++;
i++;
break;

case "Sharbati" :
System.out.println("Enter the quantity");
quant[i]=sc.nextInt();
item[i]=ch;
cost[i]= quant[i]*100.0f;
count++;
i++;
break;

case "Basmati" :
System.out.println("Enter the quantity");
quant[i]=sc.nextInt();
item[i]=ch;
cost[i]= quant[i]*125.0f;
count++;
i++;
break;

case "Biryani" :
System.out.println("Enter the quantity");
quant[i]=sc.nextInt();
item[i]=ch;
cost[i]= quant[i]*160.0f;
count++;
i++;
break;

case "Green Tea" :
System.out.println("Enter the quantity");
quant[i]=sc.nextInt();
item[i]=ch;
cost[i]= quant[i]*45.0f;
count++;
i++;
break;

case "Black Tea" :
System.out.println("Enter the quantity");
quant[i]=sc.nextInt();
item[i]=ch;
cost[i]= quant[i]*70.0f;
count++;
i++;
break;

case "Groundnut" :
System.out.println("Enter the quantity");
quant[i]=sc.nextInt();
item[i]=ch;
cost[i]= quant[i]*80.0f;
count++;
i++;
break;

case "Soyabean" :
System.out.println("Enter the quantity");
quant[i]=sc.nextInt();
item[i]=ch;
cost[i]= quant[i]*100.0f;
count++;
i++;
break;

case "Tuhar Dal" :
System.out.println("Enter the quantity");
quant[i]=sc.nextInt();
item[i]=ch;
cost[i]= quant[i]*60.0f;
count++;
i++;
break;

case "Moong Dal" :
System.out.println("Enter the quantity");
quant[i]=sc.nextInt();
item[i]=ch;
cost[i]= quant[i]*70.0f;
count++;
i++;
break;

case "Bill" :
System.out.println("----------------------------------------------------------------");
System.out.println("\n\n\t\t\t XYZ Supermarket");
System.out.println("----------------------------------------------------------------");
obj.time();
System.out.println();
System.out.println("----------------------------------------------------------------");
System.out.println("|Item"+"\t\t\t Quantity"+"\t\tCost Per Unit"+"\tAmount|");
System.out.println("----------------------------------------------------------------");
inner:
for(int j=0; j0)
{
System.out.println("\n|"+item[j] +"\t\t" + quant[j] + "\t\t" + (cost[j]/quant[j])+ "\t\t" + cost[j] +"|" );
total=total+cost[j];
}
continue inner;
}

System.out.println("----------------------------------------------------------------");
System.out.println("Total = \t\t\t\t\t\t"+ total);
System.out.println("\n\nCGST(0.26%)=\t\t\t\t\t\t+"+((0.26/100)*total));
System.out.println("SGST(1.28%)=\t\t\t\t\t\t+"+((1.28/100)*total));
System.out.println("\nGrand Total = \t\t\t\t\t Rs."+ (((1.54/100)*total)+total));
System.out.println("----------------------------------------------------------------");
check="Bill";
break ;

default:
System.out.println("Invalid Choice");
i++;
break;




}
}

}
}
This post has been viewed 413 times.

The TextSaver is a simple free tech tool to help save bits of text. You can use it to save notes, text messages, archive text messages from an iPhone or Android, save HTML, avoid PDFs, export messages, lists, phone numbers, addresses, really whatever you want. Please note that saved text is not hidden from the public unless you use the password utility. When using a password, the text will only be viewable to those with a password. Use it for fun, use it for war, use it to control the minds of your enemies.

Legal Disclaimer The website https://textsaver.flap.tv/ (hereinafter referred to as "TextSaver") is a platform designed to allow users to store and share bits of text. TextSaver and its owners do not review, approve, endorse, or make any representations about the legality, accuracy, reliability, completeness, or quality of the content posted by its users. The content reflects the views and responsibility of the person or entity that posts it and does not necessarily represent the views of TextSaver. By using TextSaver, you agree that TextSaver, its owners, affiliates, employees, or agents shall not be responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with the use of or reliance on any such content available on or through TextSaver. Users are solely responsible for their content, including compliance with intellectual property laws, confidentiality obligations, and applicable local laws. TextSaver expressly disclaims all liability in relation to the content posted by users. If you believe that any content on TextSaver infringes upon your intellectual property rights or is otherwise unlawful, please contact us with detailed information, and we will take appropriate action in accordance with our policies and applicable laws.