//public static double getAverage()
        public static double getAverage(account[] accts)
        {
            //my original version accumulated the total account numbers as they were input into the class
            //return sum / (double)count;

            double avg = 0D;
            int count = 0;

            for (int i = 0; i < accts.Length; i++)
                if (accts[i] != null)//user can input null accounts
                {
                    avg += accts[i].getAcctBal();
                    count++;//determine the true number of accounts
                }

            return avg / (double)count;
        }
        static void Main(string[] args)
        {
            //binary search can take an account type, or an integer as a search type
            //in order to binary search though, the array needs sorted
            //Console.WriteLine(Array.BinarySearch(accts, 1));

            account[] accts = new account[2];

            //instantiating a new accounts object
            accts[0] = new account(0, "Schmoe", 0.00D);//you can overwrite these in the program's prompt
            accts[1] = new account(1, "Stutte", 1111.00D);

            accts = account.promptAccount(accts);//method to fill the accounts array with user input

            //finish the menu driven system, ask to search, average, and exit

            Console.WriteLine();

            char ch;
            //int searchNum;

            while( (ch = char.ToUpper(Input.promptChar(
                "****************************************** \n"
            + "Enter an 'a' or 'A' to search account numbers, \n"
            + "Enter a 'b' or 'B' to average the accounts, \n"
            + "Enter an 'x' or 'X' to exit the program. \n"
            + "****************************************** \n"
            + "Enter an option: ",
            "\nPlease enter valid character data... ",
            new char[]{'A', 'B', 'X'}))) != 'X' )
            {
                Console.WriteLine();

                if(char.ToUpper(ch) == 'A')
                {
                    account.searchPrompt(accts);
                }
                else if(char.ToUpper(ch) == 'B')
                {
                    //Console.WriteLine(string.Format(
                    //    "The average dollar amount for the accounts is: {0:C}",
                    //    account.getAverage()));
                    Console.WriteLine(string.Format(
                        "The average dollar amount for the accounts is: {0:C}",
                        account.getAverage(accts)));
                }
            }//end loop

            Console.WriteLine();

            pause();
        }
        public static void searchPrompt(account[] accts)
        {
            int searchNum = Input.promptInt32(
                "Enter an account number to search for: ",
                "\nPlease enter valid integer data... \n");

            Console.WriteLine();

            int acctIndex = account.unorderedSearch(accts, searchNum);

            if(acctIndex == -1)
                Console.WriteLine("You entered an invalid account... ");
            else if (accts[acctIndex] == null)//there can be null entries
                Console.WriteLine("You entered an invalid account... ");
            else
                Console.WriteLine(
                    accts[acctIndex].ToString());//find the account and print it
        }
        public static int unorderedSearch(account[] accounts, int acctNum)
        {
            for (int i = 0; i < accounts.Length; i++)
                if (accounts[i].CompareTo(acctNum) == 0)
                    return i;

            return -1;
        }
        public static account[] promptAccount(account[] accts)
        {
            //This method gets input from the user and makes an array out of the results

            ArrayList accounts = new ArrayList(accts);//send the input array to the ArrayList
            bool firstRun = true;

            do
            {
                Console.Write(firstRun ? "" : "\n");

                int acctNum = Input.promptInt32("Enter the integer account number: ",
                    "Please Enter a valid integer... ");

                double bal = Input.promptDouble("Enter the account balance: ",
                    "Please enter a valid double... ");

                string name = Input.promptString("Enter the account holder last name: ",
                    "Please enter a valid string... ");

                accounts.Add(new account(acctNum, name, bal));

                firstRun = false;

                //the likelihood of this method erroring out is not very high
            } while (char.ToUpper(Input.promptChar("Would you like to continue?: ",
                "I don't know what you did, but that was awesome!!! ")) != 'N');

            //was a little hard to find how to do this
            return (account[])accounts.ToArray(typeof(account));
        }