Answer:
#include <iostream>
using namespace std;
int main()
{
int age = 28;
char menu_selection;
cout << "Choose an item (S, T, or B) on the menu: ";
cin >> menu_selection;
if (menu_selection == 'S'){
if (age <= 21){
cout<<"Recommendation is vegetable juice";
}
else{
cout<<"Recommendation is cabernet";
}
}
else if (menu_selection == 'T'){
if (age <= 21){
cout<<"Recommendation is cranberry juice";
}
else{
cout<<"Recommendation is chardonnay";
}
}
else if (menu_selection == 'B'){
if (age <= 21){
cout<<"Recommendation is soda";
}
else{
cout<<"Recommendation is IPA";
}
}
else{
cout<<"Invalid menu selection";
}
return 0;
}
Step-by-step explanation:
Here is your solution in C++.
Initialize age, declare menu selection, and ask the user to make their choice.
Then check for each condition using if-else structure. Depending on the user choice and value of the age, print the recommendation.