1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
TEA [102]
3 years ago
9

Assume that an int variable age has been declared and already given a value and assume that a char variable choice has been decl

ared as well. Assume further that the user has just been presented with the following menu:
S: hangar steak, red potatoes, asparagus

T: whole trout, long rice, brussel sprouts

B: cheddar cheeseburger, steak fries, cole slaw

(Yes, this menu really IS a menu!)

Write some code that reads a single character (S or T or B) into choice . Then the code prints out a recommended accompanying drink as follows:

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.
Computers and Technology
1 answer:
vampirchik [111]3 years ago
8 0

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;

}

Explanation:

Here is your solution in C++.

Initialize <em>age</em>, declare <em>menu selection</em>, and ask the user to make their choice.

Then check for each condition using if-else structure. <u>Depending on the user choice</u> and <u>value of the age</u>, print the recommendation.

You might be interested in
Which is the last step in conducting a url research
tino4ka555 [31]
<span> The user's browser renders the html code as a visual web page. I think. Let me know if I git it wrong! :P</span>
6 0
4 years ago
What is the value of the variable result after these lines of code are executed?
Crank

Answer:

18

Explanation:

If you take the formula, and you substitute the values of the variables, it will be:

    10 * 2 - 10 / 5

Then if you remember the order of math operations, it will be:

    (10 * 2) - (10 / 5)

Which reduces to:

    20 - 2 = 18

4 0
3 years ago
Check
Ne4ueva [31]

Answer:

B,C,E :)

Explanation:

8 0
3 years ago
A metacharacter is a character that has a special meaning assigned to it and is recognized as part of a scripting or programming
nydimaria [60]

Answer:

The answer is "Option a"

Explanation:

Meta-character is a unique character, which is used in the system or information area, that provides information about the other characters. This type of character is used in both command-line and programming.  

  • It has a particular meaning and should be prevented for reasons except for its particular importance.
  • It attempts in the algorithmic technique to view all character as a fundamental ASCII instead of a specific purpose.
3 0
3 years ago
Injection attacks variants can occur whenever one program invokes the services of another program, service, or function and pass
velikii [3]

Answer:

True

Explanation:

In Computer science, It's true that injection attacks variants can occur whenever one program invokes the services of another program, service, or function and passes to it externally sourced, potentially untrusted information without sufficient inspection and validation of it.

5 0
3 years ago
Other questions:
  • To decrease the size of text so it will fit into a text box without overflowing, select the
    14·2 answers
  • You need to write a loop that will repeat exactly 125 times. which is the preferred loop construct to use?
    12·1 answer
  • What would be the results of the following code? final int SIZE = 25; int[] array1 = new int[SIZE]; … // Code that will put valu
    9·1 answer
  • 1.the following code example would print the data type of x, what data type would that be?
    12·1 answer
  • Which pair of features is relevant when buying a pc?
    9·2 answers
  • Sales management wants a small subset of users with different profiles and roles to be able to view all data for compliance purp
    7·1 answer
  • Define Indentation
    8·1 answer
  • Select the correct answer from each drop down menu
    8·2 answers
  • Misspelet errors are displays with a ...<br>.. below them<br>​
    10·1 answer
  • Advancing technology has made life easier for people and businesses today. Imagine that you have to work for an entire day witho
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!