get rid of the set of brackets that start after meal5 = scan.nextInt() and that end after mealtoeat = scan.nextInt(), those aren't needed and will cause errors.
try adding
String foodA = " ";
String foodB = " ";
String foodC = " ";
String foodD = " ";
String foodE = " ";
int mealtoeat2 = 0;
and
int meal1 = 0;
int meal2 = 0;
int meal3 = 0;
int meal4 = 0;
int meal5 = 0;
int choice =0;
System.out.println("Choose the meal you want to eat. 1 = " + foodlA + " 2 = " + foodlB + " 3 = " + foodC + " 4 = " + foodD + " 5 = " + foodE + ".");
boolean isAValidMeal = false;
while (isAValidMeal ==false)
{
mealtoeat = scan.nextInt();
if (mealtoeat==1)
{
what you'll do when it's 1
isAValidMeal = true;
}
else if (mealtoeat ==2)
{
what you'll do when it's 2
isAValidMeal = true;
}
else if (mealtoeat ==3)
{
what you'll do when it's 3
isAValidMeal = true;
}
else if (mealtoeat ==4)
{
what you'll do when it's 4
isAValidMeal = true;
}
else if (mealtoeat ==5)
{
what you'll do when it's 5
isAValidMeal =true;
}
else
{
System.out.println("Enter a value between 1 and 5.");
isAValidMeal = false;
}
}
I'm assuming you're asking how many of a certain meal type of a certain food you'd like to eat.
If so, within each if and else if statement, have, for example, for the first if statement
boolean isAValidNumber = false;
while (isAValidNumber == false)
{
System.out.println("You have " + meal1 + " of " + mealA + "! How many " + mealA + " would you like to eat?");
mealtoeat2 = console.nextInt();
if (mealtoeat2 > 0 && mealtoeat2 <= meal1)
{
it works and do what you have to do
isAValidNumber = true;
}
else
{
System.out.println("Enter a number at least 0 and at most the number of meals you made for that type.");
isAValidNumber = false;
}
}
You'll have to do something similar for the other ones.