173k views
0 votes
If the value of age is 21 or lower, the recommendation is "vegetable juice" for steak, "cranberry juice" for trout, and "soda" for the burger. Otherwise, the recommendations are "cabernet", "chardonnay", and "IPA" for steak, trout, and burger respectively. Regardless of the value of age, your code should print "invalid menu selection" if the character read into choice was not S or T or B.

User EddyR
by
3.5k points

1 Answer

5 votes

Step-by-step explanation:

The computer program for the given case is;

int main void

{

char in;

int age;

printf ("Enter the menu code, you would like to have: S or T or B ")

scanf("%c", &in)

printf ("Kindly enter your age as well")

if (in==T or in==S or in==B)

{

if (in==S & age <=21)

printf(""vegetable juice")

elseif(in==T & age <=21)

printf("cranberry juice")

elseif(in==B & age <=21)

print ("Soda")

elseif(in==S & age >21)

printf( "cabernet")

elseif(in==T & age >21)

printf("chardonnay")

else

printf("IPA"

)

else

printf("Invalid menu selection")

return

User Gikkman
by
4.2k points