//dice_using_if import javax.swing.*; public class dice_using_if { public static void main( String[] args) { // Prompt the user to enter a number: String numString = JOptionPane.showInputDialog(null, "Roll the die!! (1-6):", "Input Window Demo", JOptionPane.QUESTION_MESSAGE); // Convert the string into an int value int roll = Integer.parseInt(numString); System.out.println(" You rolled a " + roll + "."); if (roll == 1 ) System.out.println("You rolled a one! Try again! \n"); else if (roll == 2 ) System.out.println("You rolled a two! Too bad! \n"); else if (roll == 3 ) System.out.println("You rolled a three! Better luck next time! \n"); else if (roll == 4 ) System.out.println("You rolled a four! Sorry! \n"); else if (roll == 5 ) System.out.println("You rolled a five! Way to go!!\n"); else if (roll == 6 ) System.out.println("You rolled a six! I guess you win ...\n"); else System.out.println("This is some wierd die! \n"); System.exit( 0 ); // terminate application } // end main }