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
Find the simple interest Jay owes on a five-year student loan of $48,000 with an annual interest rate of 5%.
Serjik [45]
P = $48,000
r (Rate) = 5%
t (Time) = 5 (Years)

Interest = Prt =(48,000)(0.05)(5)= $12,000

The simple interest is $12,000 over the course of 5 years, with an annual interest of 5% and a loan of $48,000

I hope that answers your question! (I'm new to this app so sorry if that's not what you were looking for!)
8 0
4 years ago
Write a static method that takes a String and returns an integer. Return the number of characters in the passed in, String param
patriot [66]

Answer:

Explanation:

The following code is written in the Java programming language. It is a function called howBig that takes in a String as a parameter and returns an int. The function grabs the string and then detects the size of the String (number of Characters it has) and then places that number into an Integer variable called wordSize. Then it returns the variable wordSize.

public static int howBig (String myWord) {

       int wordSize = myWord.length();

       return wordSize;

   }

4 0
3 years ago
You have a network that occupies the top floor of a three-story building. The WAN service provider has installed the line for th
patriot [66]

Answer:

Demarc Extension.

Explanation:

In this scenario, you have a network that occupies the top floor of a three-story building. The wide area network (WAN) service provider has installed the line for the WAN service in a wiring closet on the main floor.

Hence, you would use the Demarc Extension to relocate the WAN line into a wiring closet on your floor.

A Demarc Extension refers to a cabling channel or transmission path which typically originates from the interface of an internet service provider known as demarcation point to the termination point present at the premises of the end users, usually far from the minimum point of entry (MPOE).

4 0
3 years ago
Groups to which we belong are defined late in our development true or false
Anna71 [15]
The answer is false......
7 0
4 years ago
What button is marked with the little hollow square at the top of the right window
andrew11 [14]

Next to the close-window-button, is the minimize/maximize button
5 0
3 years ago
Read 2 more answers
Other questions:
  • Nonverbal communication relies on _________________. a. multiple channels b. continuous feedback c. ambiguous interpretation d.
    9·1 answer
  • How computational thinking skills impact software design and the quality of the software applications produced?
    10·1 answer
  • The _device provides a means of communication between a computer and outer world.​
    14·1 answer
  • What is indexing ? How does it make search engines work more efficiently?
    15·1 answer
  • What is the default view when you first open a PowerPoint presentation
    10·1 answer
  • The term _____________ refers to software license agreements that are included within a box of physical-media software.
    9·1 answer
  • Write a program that will ask the user for three different numerical values. The program should then decide whether the values a
    13·1 answer
  • What is bit in computer science? (You must select all correct answers.) Hb. A. A part of a tool, such as a router. Non. B. A bas
    6·2 answers
  • Why big data influnce the rise of AI<br><br>​
    8·2 answers
  • When using a self-contained recovery device on a cfc, hcfc, or hfc system with an operating compressor, technicians must?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!