Answer:
Hi!
The method in Java:
public void chooseMenuAndDrink(int age) {
String menu;
Scanner stdin = new Scanner(System.in);
menu = stdin.next().charAt(0); //read the char and save the value on menu.
if ( menu.equals("S") ) { // if menu is S
if(age > 21) { // and age > 21
System.out.println("cabernet"); // prints cabernet
} else { System.out.println("vegetable juice"); } // else prints vegetable juice
}
if ( menu.equals("T") ) {
if(age > 21) {
System.out.println("chardonnay");
} else { System.out.println("cranberry juice"); }
}
if ( menu.equals("B") ) {
if(age > 21) {
System.out.println("IPA");
} else { System.out.println("soda"); }
}
if (!menu.equals("B") & !menu.equals("T") & !menu.equals("S")) { // if menu is not B, T or S
System.out.println("invalid menu selection"); // prints invalid menu selection
}
}