Create a fast food ordering system using the below data 1 Pr

Create a fast food ordering system using the below data.

1) Prompt user to select value, burger, salad and/or drink

2) Depending on answer provide user with option susing SELECT CASE STATEMENT

3) Once an item has been selected prompt the user with the price and ask if they want another

4) If the answer is yes, open program again

5) If the answer is no, calculate the total $

A B C D E F G H Price SALAD Price Drink Price 1 BURGER Price VALUE THING $3.40 COKE $1.00 SALAD 1 $4.50 VALUE 1 $4.50 2 HAMBURGER $4.30 FANTA $1.00 SALAD 2 $6.66 VALUE 2 $3.00 3 SALAD 4 FRIES $4.00 $1.50 DIET FANTA $1.00 SALAD 3 $6.78 VALUE 3 $1.00 SALAD 4 $2.56 VALUE 4 5 FRIED STUFF $6.50 FANTA ZERO $6.00

Solution

menu.java

import java.util.Scanner;

public class menu {

   public double subTotal;
   public static double runningTotal;
   private static double itemPrice;
   static boolean ordering = true;
   static Scanner input = new Scanner(System.in);
   public static void menu(){
   System.out.println(\"Welcome \ 1. Burger ($6.00) \ 2. Salad ($5.50)\ 3. Drink ($3.00) \ 4. Done\");
   }
public static double itemPrice(int foodItem) {
if (foodItem == 1) {
  
System.out.println(\"You\'ve ordered a burger\");
itemPrice = 6.00;
}
if (foodItem == 2) {
  
System.out.println(\"You\'ve ordered Salad\");
itemPrice = 5.50;
}
if (foodItem == 3) {
  
System.out.println(\"You\'ve ordered a Drink\");
itemPrice = 3.00;
}
quantity();
return itemPrice;
}
public static double quantity() {
System.out.println(\"Enter quantity\");   
double quantity = input.nextDouble();
subTotal(quantity, itemPrice);
return quantity;
}
public static double subTotal(double quantity, double itemPrice) {
double subTotal = quantity*itemPrice;
System.out.println(\"Subtotal: \"+ subTotal);
runningTotal += subTotal;
return subTotal;
}
public static void done(){
ordering = false;
System.out.println(runningTotal);
System.out.println(\"Enjoy your meal\");
}

public static void main(String[] args) {
int menuOption;
int foodItem = 0;
input = new Scanner(System.in);
do{
double runningTotal=0;
menu();
menuOption = input.nextInt();
switch(menuOption){
case 1:
foodItem = 1;
itemPrice(foodItem);
break;
case 2:
foodItem = 2;
itemPrice(foodItem);
break;
case 3:
foodItem = 3;
itemPrice(foodItem);
break;
case 4:
done();
break;
default:
System.out.println(\"Invalid option.\");
}

} while(ordering);{}
  
}
}

Create a fast food ordering system using the below data. 1) Prompt user to select value, burger, salad and/or drink 2) Depending on answer provide user with opt
Create a fast food ordering system using the below data. 1) Prompt user to select value, burger, salad and/or drink 2) Depending on answer provide user with opt

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site