Need JAVA code for this question. Ratings will be given to the user with the cor
ID: 3751403 • Letter: N
Question
Need JAVA code for this question. Ratings will be given to the user with the correct answer!
18. Restaurant Selector You have a group of friends coming to visit for your high school reunion, and you want to take them out to eat at a local restaurant. You aren't sure if any of them have dietary restrictions, but your restaurant choices are as follows: Joe's Gourmet Burgers - Vegetarian: No, Vegan: No, Gluten-Free: No Main Street Pizza Company - Vegetarian: Yes, Vegan: No, Gluten-Free: Yes Corner Café-Vegetarian: Yes, Vegan: Yes, Gluten-Free: Yes Mama's Fine Italian - Vegetarian: Yes, Vegan: No, Gluten-Free: No The Chef's Kitchen -Vegetarian: Yes, Vegan: Yes, Gluten-Free: Yes Write a program that asks whether any members of your party are vegetarian, vegan, or gluten-free, and then displays only the restaurants that you may take the group to. Here is an example of the program's output Is anyone in your party a vegetarian? yes [Enter Is anyone in your party a vegan? no [Enter Is anyone in your party gluten-free? yes [Enter] Here are your restaurant choices: Main Street Pizza Company Corner Cafe The Chef's Kitchen Here is another example of the program's output Is anyone in your party a vegetarian? yes [Enter] Is anyone in your party a vegan? yes [Enter) 295 Is anyone in your party gluten-free? yes [Enter] Here are your restaurant choices: Corner Cafe The Chef's KitchenExplanation / Answer
The code is pasted below. The code is very simple and self explainatory
public class RestaurantSelector {
public static void main(String[] args)
{
String is_vegeterian;
String is_vegan;
String is_glutenfree;
Scanner user_input = new Scanner(System.in);
System.out.println("Is anyone in your party a vegetarian?");
is_vegeterian = user_input.nextLine();
System.out.println("Is anyone in your party a vegan?");
is_vegan = user_input.nextLine();
System.out.println("Is anyone in your party gluten-free?");
is_glutenfree = user_input.nextLine();
System.out.println("Here are you restaurant selections: ");
if (is_vegeterian.equalsIgnoreCase("no") && is_vegan.equalsIgnoreCase("no") && is_glutenfree.equalsIgnoreCase("no"))
{
System.out.println("Joe's Gourmet Burgers");
System.out.println("Main Street Pizza Company");
System.out.println("Corner Cafe");
System.out.println("Mama's Fine Italian");
System.out.println("The Chef's Kitchen");
}
else if (is_vegeterian.equalsIgnoreCase("yes") && is_vegan.equalsIgnoreCase("no") && is_glutenfree.equalsIgnoreCase("no"))
{
System.out.println("Main Street Pizza Company");
System.out.println("Corner Cafe");
System.out.println("Mama's Fine Italian");
System.out.println("The Chef's Kitchen");
}
else if (is_vegeterian.equalsIgnoreCase("yes") && is_vegan.equalsIgnoreCase("yes") && is_glutenfree.equalsIgnoreCase("no"))
{
System.out.println("Corner Cafe");
System.out.println("The Chef's Kitchen");
}
else if (is_vegeterian.equalsIgnoreCase("yes") && is_vegan.equalsIgnoreCase("yes") && is_glutenfree.equalsIgnoreCase("yes"))
{
System.out.println("Corner Cafe");
System.out.println("The Chef's Kitchen");
}
else if (is_vegeterian.equalsIgnoreCase("yes") && is_vegan.equalsIgnoreCase("no") && is_glutenfree.equalsIgnoreCase("yes"))
{
System.out.println("Main Street Pizza Company");
System.out.println("Corner Cafe");
System.out.println("The Chef's Kitchen");
}
else if (is_vegeterian.equalsIgnoreCase("no") && is_vegan.equalsIgnoreCase("no") && is_glutenfree.equalsIgnoreCase("yes"))
{
System.out.println("Main Street Pizza Company");
System.out.println("Corner Cafe");
System.out.println("The Chef's Kitchen");
}
else if (is_vegeterian.equalsIgnoreCase("no") && is_vegan.equalsIgnoreCase("yes") && is_glutenfree.equalsIgnoreCase("no"))
{
System.out.println("Corner Cafe");
System.out.println("The Chef's Kitchen");
}
else if (is_vegeterian.equalsIgnoreCase("no") && is_vegan.equalsIgnoreCase("yes") && is_glutenfree.equalsIgnoreCase("yes"))
{
System.out.println("Corner Cafe");
System.out.println("The Chef's Kitchen");
}
else
{
System.out.println("Incorrect entry, enter either yes or no.");
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.