subject

Assume that an int variable age has been declared and already given a value and assume that a char variable choice has been declared 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.

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 05:20, ashcormu11
Write a program called assignment3 (saved in a file assignment3.java) that computes the greatest common divisor of two given integers. one of the oldest numerical algorithms was described by the greek mathematician, euclid, in 300 b. c. it is a simple but very e↵ective algorithm that computes the greatest common divisor of two given integers. for instance, given integers 24 and 18, the greatest common divisor is 6, because 6 is the largest integer that divides evenly into both 24 and 18. we will denote the greatest common divisor of x and y as gcd(x, y). the algorithm is based on the clever idea that the gcd(x, y) = gcd(x ! y, y) if x > = y and gcd(x, y) = gcd(x, y ! x) if x < y. the algorithm consists of a series of steps (loop iterations) where the “larger” integer is replaced by the di↵erence of the larger and smaller integer. this continues until the two values are equal. that is then the gcd.
Answers: 3
image
Computers and Technology, 22.06.2019 14:40, davidb1113
You begin your first day of responsibilities by examining the recent is security breach at gearup to get ideas for safeguards you will take. at gearup, criminals accessed the company's improperly-secured wireless system and stole customers' credit card information as well as employee social security numbers. what kind of computer crime did gearup face?
Answers: 3
image
Computers and Technology, 24.06.2019 02:10, sIatt
Consider the usual algorithm to convert an infix expression to a postfix expression. suppose that you have read 10 input characters during a conversion and that the stack now contains these symbols: (5 points) | | | + | | ( | bottom |_*_| now, suppose that you read and process the 11th symbol of the input. draw the stack for the case where the 11th symbol is
Answers: 2
image
Computers and Technology, 24.06.2019 19:50, joejoefofana
How to unblock on chrome book? ?
Answers: 1
You know the right answer?
Assume that an int variable age has been declared and already given a value and assume that a char v...

Questions in other subjects:

Konu
Mathematics, 08.07.2020 06:01
Konu
Mathematics, 08.07.2020 06:01
Konu
Mathematics, 08.07.2020 06:01