answersLogoWhite

0

import java.io.*;

class Bill

{

String item[]={"A","B","C","D","E","F","G","H","I","J"};

double rate[]={1,2,3,4,5,6,7,8,9,10};

String order[]=new String[10];

double amt[]=new double[10];

String ans;

int quantity[]=new int[10];

int i,n=0,no,x=0;

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

Bill()

{

}

public void putOrder()throws IOException

{

System.out.println("**********************************************");

System.out.println("Kentucky Fried Chicken- MENU CARD");

System.out.println("*********************************************");

System.out.println("Item No. Item Rate");

for(i=0;i< 10;i++)

{

System.out.println((i+1)+ ": "+item[i]+"------------------"+rate[i]);

}

System.out.println("Enter item number to place your order\n");

while(true)

{

if(x==10)

break;

System.out.println("Enter item number:");

no=Integer.parseInt(br.readLine());

order[x]=item[no-1];

amt[x]=rate[no-1];

System.out.println("Enter quantity:");

no=Integer.parseInt(br.readLine());

quantity[x]=no;

x++;

if(x>0)

{

System.out.println("Any More Items ?(Y/N):");

ans=br.readLine().toUpperCase();

if(ans.equals("N"))

break;

}

}

showBill();

}

private void showBill() throws IOException

{

double bamt=0,b;

System.out.println("You have ordered\n");

System.out.println("Item Rate No. of quantity");

for(i=0;i< x;i++)

{

System.out.println((i+1)+":"+order[i]+"---------"+amt[i]+"------------"+quantity[i]);

}

while(true)

{

if(x< 2)

break;

System.out.println("Do you want to cancel any item (Y/N):");

ans=br.readLine().toUpperCase();

if(ans.equals("N"))

break;

System.out.println("Enter the item number of the item you want to cancel:");

no=Integer.parseInt(br.readLine());

for(i=no-1;i< x-1;i++)

{

order[i]=order[i+1];

amt[i]=amt[i+1];

quantity[i]=quantity[i+1];

}

x--;

}

System.out.println("Cash Memo\n");

System.out.println("*****************************************************************");

System.out.println("Item No. of quantity Rate Amount\n");

System.out.println("***************************************************************");

for (i=0;i< x;i++)

{

System.out.print( order[i]+ " "+quantity[i]+ " "+ amt[i]+ " ");

b=quantity[i]*amt[i];

System.out.println(b);

bamt=bamt+b;

}

System.out.println("Bill Amount Rs. "+bamt);

System.out.println("*******************");

bamt=bamt+bamt*.125;

System.out.println("Total Amount including service charge @ 12.5% Rs. "+bamt);

}

}

User Avatar

Wiki User

11y ago

What else can I help you with?

Continue Learning about Engineering

Is there a Java program for finding the zodiac sign?

I could make one, but "a program of zodiac signs" tells me little.


What do you get when you compile a java program?

The java interpreter or JVM (Java Virtual Machine) is not able to execute the java source code for a program. The java source code first needs to be compiled into bytecode that can be processed by JVM. Producing bytecode make the program platform independent as each platform has its own JVM. It is also possible to directly write bytecode, bypassing the need to compile, but that would be tedious job and also not good for security purpose as the compiler checks for various errors in a program.


How do you solve no console in java i have already enabled java console in java window from control panel but whenever i run my java program i keep receiving a no console message?

If you have enabled the Java Console in the Java Control Panel but are still not seeing the console when running your Java program, there are a few possible reasons for this issue. Firstly, ensure that your Java program is actually printing output to the console using System.out.println() statements. Additionally, check if your program is running in an environment that supports console output, such as a terminal or command prompt. Finally, make sure that your program is not terminating too quickly before you can see the console output, as this can sometimes give the appearance of no console being available.


How do you make an antivirus program using Java?

A running java program only has access to the memory allocated to it by the Java Runtime Environment. Java by design does not allow access to absolute memory locations which is required to scan for memory resident viruses. A Java-based anti-virus program can still read a virus-signature file and use it to scan for those patterns in files to identify possible infected files.


How do you write a java program to make a periodic table?

See the related links section for a link to a JAR file containing this program.

Related Questions

Who make Java Program?

Many people make Java programs, but if you mean who invented the Java programming language it was James Gosling of Sun Microsystems.


What do a java developer do?

A Java developer helps create a program which can understand any form of computer language. A Java developer tries to make a program that can understand the computer language that is on any computer platform.


How do people make minecraft mods?

They program them using code and Java.


How can you make java program to solve finite automata?

A person can make a Java program solve Finite Automata by creating a tool with Discrete. This should be done overt a network, so that all employees have access to the programming.


Is there a Java program for finding the zodiac sign?

I could make one, but "a program of zodiac signs" tells me little.


What do you get when you compile a java program?

The java interpreter or JVM (Java Virtual Machine) is not able to execute the java source code for a program. The java source code first needs to be compiled into bytecode that can be processed by JVM. Producing bytecode make the program platform independent as each platform has its own JVM. It is also possible to directly write bytecode, bypassing the need to compile, but that would be tedious job and also not good for security purpose as the compiler checks for various errors in a program.


How do you run java program in ubuntu OS?

Download the JRE (java runtime environment) from Sun's website. make sure you get a version that will run on your os.


How do you solve no console in java i have already enabled java console in java window from control panel but whenever i run my java program i keep receiving a no console message?

If you have enabled the Java Console in the Java Control Panel but are still not seeing the console when running your Java program, there are a few possible reasons for this issue. Firstly, ensure that your Java program is actually printing output to the console using System.out.println() statements. Additionally, check if your program is running in an environment that supports console output, such as a terminal or command prompt. Finally, make sure that your program is not terminating too quickly before you can see the console output, as this can sometimes give the appearance of no console being available.


How do you make an antivirus program using Java?

A running java program only has access to the memory allocated to it by the Java Runtime Environment. Java by design does not allow access to absolute memory locations which is required to scan for memory resident viruses. A Java-based anti-virus program can still read a virus-signature file and use it to scan for those patterns in files to identify possible infected files.


How do you write a java program to make a periodic table?

See the related links section for a link to a JAR file containing this program.


In relation to Java what is a thread?

A Java Thread is a thread of execution in a Java Program. A Java Virtual Machine can have a single application running multiple threads, which is known as concurrency. Threads are what make the program run. Each thread has a different priority, and when the machine queue fills up, the threads are executed in the order of their priority.


Does using Java make a computer accessible to viruses?

sometimes, it all depends on what program you are using.