Question

In: Computer Science

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

    • 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

As you not asked for any specific languge, I am answering in C++.

By the way, code is easy to undersatand, so you can have a idea and covert it in your own desired language.

Assumption: I am assuming, if there is a vegan guy in group then, you will say yes for both vegan and vegetarian.

Approch :

First I asked user to tell me what is your requirement(took input from console).

I used conditional statements(if-else) to consider all possible cases.

All  restaurant that satisfies group's requirement, I printed them.

#include<iostream>
#include<string>
using namespace std;
int main()
{
    string vegetarian, vegan, GlutenFree;
    cout<<"Is anyone in your party a vegetarian? ";
    cin>>vegetarian;
    cout<<"\nIs anyone in your party a vegan? ";
    cin>>vegan;
    cout<<"\nIs anyone in your party gluten-free? ";
    cin>>GlutenFree;
    if((vegetarian == "no") && (vegan == "no") && (GlutenFree == "no"))
        cout<<"Joe’s Gourmet Burgers\nMain Street Pizza Company\nCorner Café\nMama’s Fine Italian\nThe Chef’s Kitchen\n";
    else if((vegetarian == "yes") && (vegan == "no") && (GlutenFree == "no"))
        cout<<"Main Street Pizza Company\nCorner Café\nMama’s Fine Italian\nThe Chef’s Kitchen\n";
    else if((vegetarian == "yes") && (vegan == "no") && (GlutenFree == "yes"))
        cout<<"Main Street Pizza Company\nCorner Café\nThe Chef’s Kitchen\n";
    else if((vegan == "yes") && (GlutenFree == "no"))
        cout<<"Corner Café\nThe Chef’s Kitchen\n";
    else if((vegan == "yes") && (GlutenFree == "yes"))
        cout<<"Corner Café\nThe Chef’s Kitchen\n";
}

Output :

testcase 1:

testcase 2 :

Try running above code on your own system.

Like, if this helped :)


Related Solutions

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...
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....
Jack, Jill, Mike and Molly are deciding whether or not to attend their high school reunion....
Jack, Jill, Mike and Molly are deciding whether or not to attend their high school reunion. However, not all four of them get along well and they would prefer to stay at home rather than meeting someone they do not like at the reunion. In particular, Jack prefers not to attend the reunion if Molly is attending the reunion, otherwise he prefers to attend. Molly prefers not to attend if Jack and/or Jill attends otherwise she prefers to attend. Mike...
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...
Parth and Brittany have been your best friends since grade school. You, Parth, and Brittany have...
Parth and Brittany have been your best friends since grade school. You, Parth, and Brittany have decided to quit your respective jobs and start up a bakery together since you all love cupcakes. Parth insists he wants to start the business as a partnership. Brittany says that she wants to start the business as a corporation. You want to weigh in and give your opinion as to the best form of business. 1. What are the options for business form?...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT