Menu Card:
1. Coffee Rs.15
2. Tea Rs.10
3. Cold Coffee Rs.25
4.MilkShake Rs.50
Enter your choice
2
You have selected Tea.
Enter the quantity
3
Total amount=30
Press 1 to continue shopping or any other key to exit
3
Thank you come again..
———————————————————————–
import java.util.*;
class Project
{
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
int c=1;
while(c==1)
{
int qty;
System.out.println(“\n\tMenu Card:”);
System.out.println(“\n\t1. Coffee Rs.15”);
System.out.println(“\n\t2. Tea Rs.10”);
System.out.println(“\n\t3. Cold Coffee Rs.25”);
System.out.println(“\n\t4.MilkShake Rs.50”);
System.out.println(“\nEnter your choice”);
int ch=s.nextInt();
switch(ch)
{
case 1:
System.out.println(“You have selected coffee.”);
System.out.println(“Enter the quantity”);
qty=s.nextInt();
System.out.println(“Total amount=”+(qty*15));
break;
case 2:
System.out.println(“You have selected Tea.”);
System.out.println(“Enter the quantity”);
qty=s.nextInt();
System.out.println(“Total amount=”+(qty*10));
break;
case 3:
System.out.println(“You have selected Cold Coffee.”);
System.out.println(“Enter the quantity”);
qty=s.nextInt();
System.out.println(“Total amount=”+(qty*25));
break;
case 4:
System.out.println(“You have selected Milkshake.”);
System.out.println(“Enter the quantity”);
qty=s.nextInt();
System.out.println(“Total amount=”+(qty*50));
break;
default:
System.out.println(“Invalid choice..”);
}
System.out.println(“Press 1 to continue shopping or any other key to exit”);
c=s.nextInt();
}
System.out.println(“\nThank you come again..”);
}
}