Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Casino {
- public static final PlayingCards.MersenneTwister MRAND = new PlayingCards.MersenneTwister();
- public static double wallet = 1000;
- public static void play() {
- System.out.println("Welcome to the Casino!");
- switch(menu()) {
- case 1:
- Baccarat.play();
- break;
- case 2:
- (new Blackjack()).play();
- break;
- case 0:
- System.out.print("See you next time!");
- }
- }
- public static int menu() {
- System.out.println("What game would you like to play?");
- System.out.println("1) Baccarat");
- System.out.println("2) Blackjack");
- System.out.println("0) Exit Casino");
- return getInt(0, 2);
- }
- public static int getInt(int min, int max) {
- try {
- int t = (new java.util.Scanner(System.in)).nextInt();
- if(t < min || t > max) throw new Exception();
- else return t;
- } catch (Exception e) {
- System.out.printf("Invalid. Please enter a number between %d and %d.%n", min, max);
- return getInt(min, max);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement