Exemple #1
0
 //Method to Credit an exisiting Account
 public static void CreditAccount(string[] splitStrings)
 {
     if (LuhnCheck.CheckSum(creditCards.GetValueOrDefault(splitStrings[1])) == true)
     {
         int currentBalance = CurrencyStringConvertToInt(userBalances.GetValueOrDefault(splitStrings[1]));
         userBalances[splitStrings[1]] = string.Format("${0}", (currentBalance - CurrencyStringConvertToInt(splitStrings[2])).ToString());
     }
 }
Exemple #2
0
        //Method to Create new credit card accounts
        public static void CreateAccount(string[] splitStrings)
        {
            userNames.Add(splitStrings[1]);
            if (LuhnCheck.CheckSum(splitStrings[2]) == true)
            {
                userBalances.Add(splitStrings[1], string.Format("${0}", 0.ToString()));
            }
            else
            {
                userBalances.Add(splitStrings[1], "Error");
            }

            creditCards.Add(splitStrings[1], splitStrings[2]);
            creditLimits.Add(splitStrings[1], CurrencyStringConvertToInt(splitStrings[3]));
        }