Assignment #59 Three Card Monte
Code
/// Name: Koosha Kimelman
/// Period: 7
/// Program Name: Three Card Monte
/// File Name: ThreeCardMonte.java
/// Date Completed: 11/6/15
import java.util.Random;
import java.util.Scanner;
public class ThreeCardMonte {
public static void main(String[] args) {
Random r = new Random();
Scanner keyboard = new Scanner(System.in);
int answer, guess;
answer = (1+r.nextInt(3));
System.out.println("You are playing that game where you have three options and you have to choose the right one of the three and is basically just a scam.");
System.out.println("The person profiting from people's unknowing waste of money lays down three cards, face down, like so.");
System.out.println();
System.out.println();
System.out.println(" ### ### ###");
System.out.println(" ### ### ###");
System.out.println(" ### ### ###");
System.out.println(" 1 2 3 ");
System.out.println();
System.out.println();
System.out.print("Which one is the ace? ");
guess = keyboard.nextInt();
System.out.println();
System.out.println();
if (answer == 1) {
System.out.println(" AAA JJJ JJJ");
System.out.println(" AAA JJJ JJJ");
System.out.println(" AAA JJJ JJJ");
System.out.println(" 1 2 3 ");
System.out.println();
System.out.println();
if (guess == answer)
System.out.println("You're right. Congrats. You win nothing");
else if (guess != answer && guess >= 1 && guess <= 3)
System.out.println("Sorry the answer was 1");
else
System.out.println("You didn't even guess one of the three possible answers.");
}
else if (answer == 2) {
System.out.println(" JJJ AAA JJJ");
System.out.println(" JJJ AAA JJJ");
System.out.println(" JJJ AAA JJJ");
System.out.println(" 1 2 3 ");
System.out.println();
System.out.println();
if (guess == answer)
System.out.println("You're right. Congrats. You win nothing");
else if (guess != answer && guess >= 1 && guess <= 3)
System.out.println("Sorry the answer was 2");
else
System.out.println("You didn't even guess one of the three possible answers.");
}
else if (answer == 3) {
System.out.println(" JJJ JJJ AAA");
System.out.println(" JJJ JJJ AAA");
System.out.println(" JJJ JJJ AAA");
System.out.println(" 1 2 3 ");
System.out.println();
System.out.println();
if (guess == answer)
System.out.println("You're right. Congrats. You win nothing");
else if (guess != answer && guess >= 1 && guess <= 3)
System.out.println("Sorry the answer was 3");
else
System.out.println("You didn't even guess one of the three possible answers.");
}
}
}
Picture of the output