public Form1()
 {
     InitializeComponent();
     accounts[0]       = new BankAcct("TBD", 1, 500M);
     accounts[1]       = new SilverAcct("TBD", 2, 1500M, 1, 1234);
     accounts[2]       = new GoldAcct("TBD", 3, 25000M, 2, 1234, 1.0);
     rbDeposit.Checked = true;
 }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            //Get the index of the account type
            int index = cmbxType.SelectedIndex;

            try
            {
                //Get the index of the account type
                accounts[index].Name = txtName.Text;
                //Updates the object of the appropriate class with the user info
                accounts[index].AcctNum = int.Parse(txtAcctNum.Text);
                switch (index)
                {
                case 0:
                    break;

                //For Silver and Gold:
                case 1:
                    //using downcasting, set ATM Acct Num and PIN
                    SilverAcct newSilverAcct = (SilverAcct)accounts[1];
                    newSilverAcct.ATMAccount = int.Parse(txtATMAcctNum.Text);
                    newSilverAcct.PIN        = int.Parse(txtATMPIN.Text);
                    break;

                case 2:
                    //For Gold, set the interest rate
                    GoldAcct newGoldAcct = (GoldAcct)accounts[2];
                    newGoldAcct.ATMAccount = int.Parse(txtATMAcctNum.Text);
                    newGoldAcct.PIN        = int.Parse(txtATMPIN.Text);
                    newGoldAcct.Interest   = double.Parse(txtPercent.Text);
                    break;
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Verification Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }