So I'm trying to use the scanner util in java to get some user inputs and then run a line of code with those values. I still don't know how to save an int so I can use that value later on. here is an example of what I'm trying to accomplish:
import java.util.Scanner;
class myRestaurant {
public static void main(String[] args){
String[] food;
String[] drink;
Scanner foodOrder = new Scanner(System.in);
Scanner drinkOrder = new Scanner(System.in);
food = new String[4];
drink = new String[4];
food[0]= "Hamburger";
food[1]= "Pizza";
food[2]= "Hot Dogs";
food[3]= "Salad";
drink[0]="Soda";
drink[1]="Water";
drink[2]="Tea";
drink[3]="Lemonade";
System.out.println("Please select your food followed by your drink");
System.out.println("Your " + food[foodOrder.nextInt()] + " with " + drink[foodOrder.nextInt()] + " will be ready shortly");
}}
Output
Output: "Please select your food followed by your drink"
User Inputs 2 separate int's (2) (3)
Output: "Your Hot Dogs with Lemonade will be ready shortly"
I dont know how to make it so:
Output: Please select your food Input: (value 1) Output: Now select your drink Input: (value 2)
Output: "Your (value 1) with (value 2) will be ready shortly"
Any hints on how i can get this done will be gladly appreciated.