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
leonid [27]
3 years ago
14

Assume that an int variable age has been given a value. 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 the string (S or T or B) that the user types in into a variable choice and 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:
jeka57 [31]3 years ago
5 0

Answer:

No programming language stated.

I'll answer the question using C++ programming language

Explanation:

The code goes this;

.#include <iostream>

using namespace std;

int main()

{

string order; int age;

cout<<"Press S for hangar steak, red potatoes, asparagus"<<endl;

cout<<"Press T for whole trout, long rice, brussel sprouts"<<endl;

cout<<"Press B for cheddar cheeseburger, steak fries, cole slaw"<<endl;

cout<<"Please make your order";

cin>>order;

cout<<"Please what's your age";

cin>>age;

if(order == "S" || order == "T" || order == "B")

{

if(age <= 21)

{

if(order == "S")

{

cout<<"The Recommendation is Vegetable Juice";

}

else if(order == "T")

{

cout<<"The Recommendation is Cranberry Juice";

}

else if(order == "B")

{

cout<<"The Recommendation is Soda";

}

}

else

{

if(order == "S")

{

cout<<"The Recommendation is Cabernet";

}

else if(order == "T")

{

cout<<"The Recommendation is Chardonnay";

}

else if(order == "B")

{

cout<<"The Recommendation is IPA";

}

}

}

else

{

cout<<"Invalid Menu Selection";

}

return 0;

}

You might be interested in
What is a router?
DIA [1.3K]

Answer:

A) a device that sends data to the receiving device

Explanation:

3 0
3 years ago
What are some of the challenges that could arise from setting up a file management system on a computer?
Arisa [49]
It could fail, it would take a long time setting it up and aslo it could be easily hacked.
3 0
2 years ago
A2 Suggest why the Petri dish and agar jelly needed to be sterile.​
Mashcka [7]

A Petri dish (Petri plate) is a shallow cylindrical glass lidded dish that is typically used to culture microorganisms (agar plates). There are glass and plastic Petri dishes, and both can be sterilized (using an autoclave) and re-used. Before being used for culture purposes, it is important to ensure that the Petri dish is not only clean, but also sterile. This helps prevent the contamination of the new culture.Agar is a polymer made up of various sub-units of galactose and various species of red algae. Although it has other uses including culinary and dentistry, agar plays an important role in microbiology as culture media for a variety of microorganisms.As compared to some of the other alternatives like gelatin, agar has a number of advantages which include:Cannot be easily degraded by microorganism Stronger Firmer than gelatin

6 0
3 years ago
Which relationship is possible when two tables share the same primary key?
klasskru [66]

Answer:

Many-to-one

Explanation:

Many-to-one relationships is possible when two tables share the same primary key it is because one entity contains values that refer to another entity that has unique values. It often enforced by primary key relationships, and the relationships typically are between fact and dimension tables and between levels in a hierarchy.

6 0
3 years ago
Python Code that predicts the amount of money you will have in your IRA when you retire. Inputs are: 1. Number of years until yo
zaharov [31]

Answer:

yearsUntilRetire =0

expectedInterest =-1.00

initialAmount =-1.0

expectedAmountToAdd = -1.00

while yearsUntilRetire < 1 or yearsUntilRetire > 70:

yearsUntilRetire = int(input("Number of year until you retire between 1 to 70: "))

while expectedInterest <0 :

expectedInterest = float(input("enter the expected rate : "))

if expectedInterest >= 10:

doubleCheckRate = input("do you really expect {} interest rate: ".format(expectedInterest)).lower()

if doubleCheckRate == "false":

expectedInterest =-1.00

while initialAmount < 0:

initialAmount = float(input("Enter positive initial amount for IRA: "))

while expectedAmountToAdd < 0 or expectedAmountToAdd > 2500:

expectedAmountToAdd = float(input("Enter positive IRA amount to be added each year between 0 to $2500: "))

finalContribution =initialAmount

for i in range(yearsUntilRetire):

finalContribution = finalContribution + finalContribution * (expectedInterest/100.00) + expectedAmountToAdd

if (i+1) % 5 == 0:

print("Contribution after year {} is ${:,.2f}.".format(i+1,finalContribution))

 

print("Final Contribution is ${:,.2f}.".format(finalContribution))

Explanation:

  • Use a loop to get the valid input from the user for years until retire between 1 to 70 .
  • Get the valid input for expected rate .
  • Check if expected rate is greater than or equal to 10 then ask the user again if one expect such high rate .
  • Use a loop to get valid IRA initial Contribution .
  • Use a loop to get expected Amount to add regularly in IRA .
  • Iterate over numbers of year and print the data after 5 years .
3 0
3 years ago
Other questions:
  • How many shared keys are required for a company of 70 employees who all need to communicate securely with each other?
    13·1 answer
  • After machine language, what is the next most basic type of programming language, which still uses many length strings of numera
    5·1 answer
  • 2. Which of the following statements accurately describes enzymes? A. Enzymes increase the activation energy of reactions. B. Te
    5·1 answer
  • What is key for evaluating internal controls such as human resources, logistics, information technology, risk, legal, marketing
    11·1 answer
  • Summarize why understanding the differences between surface culture and deep culture may inform your knowledge, skills, and prof
    14·1 answer
  • Which term refers to the blank areas surrounding a document page? *
    15·1 answer
  • Brian has created the following selection sort class in Java. In which line is the index of the smallest value returned? In whic
    8·1 answer
  • Borrowing money affects both assests and owners equity. True or false?​
    13·1 answer
  • Which function works best when you need to remove an element at a specific index in a list?
    11·1 answer
  • This site isn't letting me add my ans and wut should I do?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!