/* * @topic T00836 Using DicePair with rollSeries() Nov 10 2015 * @brief Main driver */ package diceroll; public class Main { public static void main(String[] args) { int dieSideCount = 6; DicePair pair = new DicePair( dieSideCount ); int total = pair.roll(); System.out.println( "total " + total ); Menu menu = new Menu(); menu.attach( "1 Roll Once" ); menu.attach( "2 Roll Series" ); menu.attach( "3 Quit" ); int choice = Menu.CHOICE_UNKNOWN; while ( choice != Menu.CHOICE_QUIT ) { choice = menu.getUserChoice(); switch( choice ) { case Menu.CHOICE_ROLL_SERIES: int numberOfRolls = Validator.getInt( Menu.sc, "How many dice rolls would you like: "); pair.resetStats(); pair.rollSeries( numberOfRolls ); pair.displayTotalStats(); break; case Menu.CHOICE_ROLL: total = pair.roll(); System.out.println( "total " + total ); break; case Menu.CHOICE_QUIT: System.out.println( "Bye!" ); break; default: // TODO -- warn about internal application logic error break; }//switch }//while }//main }//class Main