Output message based on string input
import java.util.Scanner; public class ATM { public static void main(String args[]) { Scanner keyboard = new Scanner(System.in); System.out.println("Do you want to print a reciept?"); String answer = keyboard.next(); switch (answer.toLowerCase()) { case "y": case "yes": System.out.println("Printing reciept. Please wait."); break;/*from ww w.j ava2 s .c om*/ case "n": case "no": System.out.println("Goodbye."); break; default: System.out.println("Not a month."); } keyboard.close(); } }