static void Main(string[] args) { Simulation simulation = new Simulation(); do { simulation.RunSimulation(); }while (UserInterface.AskUserYesOrNo("Would you like to run the simulation again")); }
// Add contestants to the sweepstakes. private void AddContestantsToSweepstakes(Sweepstakes sweepstakes) { Contestant contestant; // Add contestants to sweepstakes while (UserInterface.AskUserYesOrNo("Enter contestant into \"" + sweepstakes.Name + "\" sweepstakes")) { contestant = new Contestant(); contestant.firstName = UserInterface.GetUserInputFor("contestant first name"); contestant.lastName = UserInterface.GetUserInputFor("contestant last name"); contestant.emailAddress = UserInterface.GetUserInputFor("contestant email address"); sweepstakes.RegisterContestant(contestant); UserInterface.ConfirmRegistration(sweepstakes.Name, contestant); } }
// constructor // Member methods public void RunSimulation() { UserInterface.Welcome(); CreateMarketingFirmWithManager(); // Create sweepstakes with contestants while (UserInterface.AskUserYesOrNo("Create sweepstakes", true)) { marketingFirm.CreateSweepstake(); } // Declare winners for all sweepstakes UserInterface.PrintSweepstakesResultsHeader(); while (marketingFirm.RunNextSweepstake()) { ; } }