Example #1
0
 private void btnStart_Click(object sender, EventArgs e)
 {
     if (this.ValidateFields())
     {
         bankSimulator = new BankSimulator(this.uiHelper, Convert.ToInt32(txbxNumTellers.Text), Convert.ToInt32(txbxNumCustomers.Text),
                                           Convert.ToInt32(txbxMaxTransaction.Text), Convert.ToDecimal(txbxInitialCustomerAmount.Text),
                                           Convert.ToDecimal(txbxInitialVaultAmount.Text), Convert.ToDecimal(txbxGoal.Text));
     }
 }
Example #2
0
        public Bank(UIHelper uiHelper, CancellationToken cancelToken, BankSimulator bankSimulator, int numTellers, int numCustomers, decimal customerBalance, decimal bankBalance, decimal customerGoal)
        {
            this.CustomerGoal = customerGoal;
            this.BankSim      = bankSimulator;
            // create customers in list, vault, queue, generator, tellers in list
            Customers = new CustomerList(numCustomers);
            for (int i = 0; i < numCustomers; i++)
            {
                Customers.AddCustomer(new Customer(String.Format("Customer{0}", i), customerBalance));
            }
            Vault = new BankVault(bankBalance);
            Queue = new BankQueue(numCustomers - 1);

            for (int i = 0; i < numTellers; i++)
            {
                Tellers.Add(new Teller(uiHelper, cancelToken, this));
            }
        }