Java Programming: The Program displays the Menu where the user can pick any one
ID: 665081 • Letter: J
Question
Java Programming:
The Program displays the Menu where the user can pick any one of the food type.
First Menu:
Type 1 for Italian food, type 2 for french food, type 3 for japanese food.
similarly, once the user has selected an option, the program displays the second menu.
The second Menu display:
Press 1 for entering the price \ User enters the price here
Press 2 for Discount \User can enter the discount percentage here
Press 3 for displaying the total amount. //Displays the discounted price
Using the inner loop and outer loop for the menus (loop within the loop).
Explanation / Answer
working java code compiled on ideone
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
System.out.println("Type 1 for Italian Food ");
System.out.println("Type 2 for French Food ");
System.out.println("Type 3 for Japanese Food ");
Scanner sc = new Scanner(System.in);
int a=sc.nextInt();
if (a<4)
{
System.out.println("Press 1 for entering the price ");
System.out.println("Press 2 for Discount ");
System.out.println("Press 3 for displaying the total amount ");
Scanner sca = new Scanner(System.in);
int b =sca.nextInt();
}
}
}
https://ideone.com/fWy3nX
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.