PROGRAMMING AND CODE
Assignemnt #59
Code
/// Name: Justin Li /// Period 7 /// Program Name: Threecardmonte /// File Name: Threecardmonte.java /// Date Finished: 12/3/15 import java.util.Scanner; import java.util.Random; class Threecardmonte { public static void main(String[]args) { Random r = new Random(); Scanner keyboard = new Scanner(System.in); int guess, real; real = 1 + r.nextInt(3); System.out.println("Which one is the ace?"); System.out.println("\n\n ## ## ##\n ## ## ##\n 1 2 3"); guess = keyboard.nextInt(); if (guess == 1) { if (guess == real) { System.out.println("\n\n AA ## ##\n AA ## ##\n 1 2 3\n\n YOU WIN"); } else if (guess == real) { System.out.println("\n\n AA ## ##\n AA ## ##\n 1 2 3\n\n YOU LOSE"); } } else if (guess == 2) { if (guess == real) { System.out.println("\n\n ## AA ##\n ## AA ##\n 1 2 3\n\n YOU WIN"); } else if (guess == real) { System.out.println("\n\n ## AA ##\n ## AA ##\n 1 2 3\n\n YOU LOSE"); } } else if (guess == 3) { if (guess == real) { System.out.println("\n\n ## ## AA\n ## ## AA\n 1 2 3\n\n YOU WIN"); } else if (guess == real) { System.out.println("\n\n ## ## AA\n ## ## AA\n 1 2 3\n\n YOU LOSE"); } } } }