Ok so I have been at this for 2 days now and even though I know I could probably find the answer online somewhere and copy/paste that won't help me learn it. So, if someone could help me figure out whats wrong and maybe explain it like I'm five, that would be awesome and extremely helpful.
P.S were are not up to loops or arrays yet.
Write an application that displays a menu of three items for the Jivin’ Java Coffee
Shop as follows:
(1) American 1.99
(2) Espresso 2.50
(3) Latte 2.15
Prompt the user to choose an item using the number (1, 2, or 3) that corresponds to
the item, or to enter 0 to quit the application. After the user makes the first selection,
if the choice is 0, display a total bill of $0. Otherwise, display the menu again. The user
should respond to this prompt with another item number to order or 0 to quit. If the
user types 0, display the cost of the single requested item. If the user types 1, 2, or 3,
add the cost of the second item to the first, and then display the menu a third time. If
the user types 0 to quit, display the total cost of the two items; otherwise, display the
total for all three selections.import java.util.Scanner; public class Coffee { //private static double orderStop; private static int item; private static double price; private static Scanner keyboard; private static int menuNo; public static void main(String[] args) { // TODO Auto-generated method stub price = price += service(); if (menuNo >0 || menuNo < 4) { price = service(); } else if (menuNo == 0) { System.out.println("Number of purchases " + item + "." + "\nYour total is $" + price + "." ); } else { System.out.println("Sorry. An error has occured with your order" ); } } public static double service() { //int menuNo; System.out.println("Jivin’ Java CoffeeShop"); System.out.println("MENU"); System.out.println("(1) American $1.99"); System.out.println("(2) Espresso $2.50"); System.out.println("(3) Latte $2.15"); keyboard = new Scanner(System.in); System.out.println("Please place your order. " + "\nEnter \n1 for American, " + "\n2 for Espresso, " + "\n3 for Latte " + "\nor " + "\n0 to complete and total your order."); menuNo = keyboard.nextInt(); if(menuNo == 1) { //orderStop = 0; item += 1; price +=1.99; return 1.99; } else if(menuNo == 2) { //orderStop = 0; item += 1; price += 2.50; return 2.50; } else if(menuNo == 3) { //orderStop = 0; item += 1; price += 2.15; return 2.15; } else //orderStop += 1; return 0; } }