// random_dice2: rolling a die and using "switch" to ascertain the result in your game! public class random_dice2 { public static void main(String[] args) { int roll; roll = 1 + (int) (Math.random() * 6); switch ( roll ) { case 1: System.out.println("You rolled a one! Try again! \n"); break; case 2: System.out.println("You rolled a two! Too bad! \n"); break; case 3: System.out.println("You rolled a three! Better luck next time! \n"); break; case 4: System.out.println("You rolled a four! Sorry! \n"); break; case 5: System.out.println("You rolled a five! Way to go!!\n"); break; case 6: System.out.println("You rolled a six! I guess you win ...\n"); break; default: System.out.println("This is some wierd die! \n"); } // end switch System.exit (0); } }