Question

In: Computer Science

Restaurant Selector IN JAVA You have a group of friends coming to visit for your high...

Restaurant Selector IN JAVA

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 display 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]
Is anyone in your party gluten-free? yes [Enter]
Here are your restaurant choices:
    Corner Cafe
    The Chef’s Kitchen

Solutions

Expert Solution

SOLUTION-
I have solve the problem in Java code with screenshot for easy understanding :)

CODE-

//java code

import java.util.Scanner;

//class restaurent

public class Restaurents {

//main method
public static void main(String[] args) {
  
String choice[]={"","",""};
  
Scanner sc=new Scanner(System.in);
System.out.println("Is anyone at your party vegetarian:");
choice[0]=sc.nextLine();

  
System.out.println("Is anyone at your party a vegan:");
choice[1]=sc.nextLine();
  
  
System.out.println("Is anyone at your party gluten free:");
choice[2]=sc.nextLine();
  

  
System.out.println("Here are your restaurent choices:");
  
if(choice[0].equalsIgnoreCase("yes") && choice[1].equalsIgnoreCase("yes") && choice[2].equalsIgnoreCase("yes"))
{
System.out.println("Corner's cafe");
System.out.println("Chef's kitchen");
}
else if(choice[0].equalsIgnoreCase("yes") && choice[1].equalsIgnoreCase("yes") && choice[2].equalsIgnoreCase("no"))
{
System.out.println("Corner's cafe");
System.out.println("Chef's kitchen");
}
else if(choice[0].equalsIgnoreCase("yes") && choice[1].equalsIgnoreCase("no") && choice[2].equalsIgnoreCase("yes"))
{
System.out.println("Main Street pizza company");
System.out.println("Corner's cafe");
System.out.println("Chef's kitchen");
}
else if(choice[0].equalsIgnoreCase("no") && choice[1].equalsIgnoreCase("yes") && choice[2].equalsIgnoreCase("yes"))
{
  
System.out.println("Corner's cafe");
System.out.println("Chef's kitchen");
}
else if(choice[0].equalsIgnoreCase("yes") && choice[1].equalsIgnoreCase("no") && choice[2].equalsIgnoreCase("no"))
{
System.out.println("Main Street pizza company");
System.out.println("Corner's cafe");
System.out.println("Mama's fine Italian");
System.out.println("Chef's kitchen");
}
else if(choice[0].equalsIgnoreCase("no") && choice[1].equalsIgnoreCase("no") && choice[2].equalsIgnoreCase("yes"))
{
System.out.println("Main Street pizza company");
System.out.println("Corner's cafe");
System.out.println("Chef's kitchen");
}
else if(choice[0].equalsIgnoreCase("no") && choice[1].equalsIgnoreCase("yes") && choice[2].equalsIgnoreCase("no"))
{

System.out.println("Corner's cafe");
System.out.println("Chef's kitchen");
}
else if(choice[0].equalsIgnoreCase("no") && choice[1].equalsIgnoreCase("no") && choice[2].equalsIgnoreCase("no"))
{
System.out.println("Joe's gourmet burgers");
System.out.println("Main Street pizza company");
System.out.println("Corner's cafe");
System.out.println("Mama's fine Italian");
System.out.println("Chef's kitchen");
}
  
}
  
}

SCREENSHOT-

output 1:

output 2:

IF YOU HAVE ANY DOUBT PLEASE COMMENT DOWN BELOW I WILL SOLVE IT FOR YOU:)
----------------PLEASE RATE THE ANSWER-----------THANK YOU!!!!!!!!----------


Related Solutions

Restaurant Selector You have a group of friends coming to visit for your high school reunion,...
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 –...
You and a group of friends are planning to visit a theme park, which charges $60...
You and a group of friends are planning to visit a theme park, which charges $60 for admission, $80 for a two-day pass, and $90 for a three-day pass. Your friends are interested in spending a lot of time there, but they’re worried about paying a lot of money. You explain the concept of marginal cost, which helps them see that the additional day is a good value. 1. The average cost per day of a three-day pass is   $   per person....
You are off on a camping trip to the high sierra with a group of friends...
You are off on a camping trip to the high sierra with a group of friends and one of them relays that they are scared of getting Giardia. Actually, the correct medical term is giardiasis. Fresh from a microbiology class you want to help them and proceed with a lively description of (a) the life cycle (be sure to include animal hosts), (b) symptoms one might experience if infected, (c) the availability of drugs should someone happen to contract the...
You plan to visit one of your friends living in Colorado, America in three months. You...
You plan to visit one of your friends living in Colorado, America in three months. You expect to incur the total cost of US$20,000 for lodging, meals, and transportation during your stay. As of today, the spot exchange rate is RM_____/ US$ and the three-month forward rate is RM_____/ US$ (please refer to Table 1 below for your given rates). You can buy the three-month call option on US$ with the exercise rate of RM4.3/ US$ for the premium of...
You and a group of friends wish to start a company. You have an idea, and...
You and a group of friends wish to start a company. You have an idea, and you are comparing startup incubators to apply to. (Start up incubators hold classes and help startups to contact venture capitalists and network with one another) Assume funding is normally distributed. Incubator A has a 70% success ratio getting companies to survive at least 4 years from inception. The average venture funding of the 28 companies reaching that 4 year mark, is 1.3 million dollars...
You and a group of friends wish to start a company. You have an idea, and...
You and a group of friends wish to start a company. You have an idea, and you are comparing startup incubators to apply to. (Start up incubators hold classes and help startups to contact venture capitalists and network with one another) Assume funding is normally distributed.                       Incubator A has a 80% success ratio getting companies to survive at least 4 years from inception. The average venture funding of the 28 companies reaching that 4 year mark, is 1.3 million...
You and a group of friends wish to start a company. You have an idea, and...
You and a group of friends wish to start a company. You have an idea, and you are comparing startup incubators to apply to. (Start up incubators hold classes and help startups to contact venture capitalists and network with one another) Assume funding is normally distributed. Incubator A has a 70% success ratio getting companies to survive at least 4 years from inception. The average venture funding of the 28 companies reaching that 4 year mark, is 1.3 million dollars...
You and a group of friends wish to start a company. You have an idea, and...
You and a group of friends wish to start a company. You have an idea, and you are comparing startup incubators to apply to. (Start up incubators hold classes and help startups to contact venture capitalists and network with one another) Assume funding is normally distributed.                      Incubator A has a 70% success ratio getting companies to survive at least 4 years from inception. The average venture funding of the 28 companies reaching that 4 year mark, is 1.3 million...
You and a group of friends wish to start a company. You have an idea, and...
You and a group of friends wish to start a company. You have an idea, and you are comparing startup incubators to apply to. (Startup incubators hold classes and help startups to contact venture capitalists and network with one another) Assume funding is normally distributed. Incubator A has an 80% success ratio getting companies to survive at least 4 years from inception. The average venture funding of the 28 companies reaching that 4-year mark, is 1.3 million dollars with a...
Java program for food bill There are N friends went to a restaurant and after having...
Java program for food bill There are N friends went to a restaurant and after having the meal, they want to divide the bill amount equally among them. Please write a java code to obtain the bill amount, the percentage of tax and number of people from the user. Your code should compute Total Bill amount, tax amount, and each person’s share. Where, Total bill amount= bill amount+ tax amount For example, if bill amount=100.00$ Percentage of taxes= 2 %...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT