import javax.swing.JOptionPane; import java.util.Scanner; /** * This class just contains a main method. * * @author Brad Richards * @version 1.0 */ public class Roller { /** * The main method has to have exactly this "signature": It has to be * static and void, and take an array of Strings as input (even though we * typically ignore the array of strings). */ public static void main(String[] args) { String numSidesStr = JOptionPane.showInputDialog("How many sides?"); Scanner scan = new Scanner(numSidesStr); // Read from string w/Scanner! int numSidesInt = scan.nextInt(); Die d = new Die(numSidesInt); int i = d.roll(); System.out.println("Die rolled a "+i); JOptionPane.showMessageDialog(null, "Rolled a "+i); } }