예제 #1
0
        static void Main(string[] args)
        {
            // var account = new Account
            // {
            //   User = "******",
            //   Checking = 1000,
            //   Saving = 1000
            // };
            Console.WriteLine("   Welcome to Suncoast Bank");
            Console.WriteLine("  ---------------------------");
            var tracker = new AccountTracker();
            //var account = Account();



            var accounts = new List <Account>();

            var reader    = new StreamReader("accounts.csv");
            var csvReader = new CsvReader(reader, CultureInfo.InvariantCulture);

            accounts = csvReader.GetRecords <Account>().ToList();
            var account = accounts[0];

            Console.WriteLine($"Your current checking Balance is ${account.Checking}");
            Console.WriteLine($"Your current saving Balance is ${account.Saving}");

            var isRunning = true;

            while (isRunning)
            {
                Console.WriteLine("");
                Console.WriteLine("  What would you like to do?  ");
                Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
                Console.WriteLine(" Deposit Checking or Savings");
                Console.WriteLine("Enter dc=Checking / ds=Savings");
                Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
                Console.WriteLine(" Withdraw Checking or Savings");
                Console.WriteLine("Enter wc=Checking / ws=Savings");
                Console.WriteLine(" ");
                Console.WriteLine("    Enter 'quit' to exit");
                Console.WriteLine(" ");


                var input = Console.ReadLine().ToLower();
                if (input == "checking")
                {
                    // Deposit Checking
                    Console.WriteLine("Deposit Amount:");
                    var amountToDeposit = int.Parse(Console.ReadLine());
                    tracker.DepositToCheck(account, amountToDeposit);
                    Console.WriteLine($"Checking Balance: {account.Checking}");
                }
                else if (input == "saving")
                {
                    // Deposit Savings
                    Console.WriteLine("Deposit Amount:");
                    var amountToDeposit = int.Parse(Console.ReadLine());
                    tracker.DepositToSavings(account, amountToDeposit);
                    //SaveTransaction(accounts);
                    Console.WriteLine($"Savings Balance: {account.Saving}");
                }
                else if (input == "wc")
                {
                    // Withdraw Checking
                    Console.WriteLine("Withdraw Amount:");
                    var amountToWithdraw = int.Parse(Console.ReadLine());
                    tracker.WithdrawChecking(account, amountToWithdraw);
                    Console.WriteLine($"You now have {account.Checking}");
                    //SaveTransaction(accounts);
                }
                // ammttotrans = userinput
                // acct.check =

                else if (input == "ws")
                {
                    // Withdraw Savings
                    Console.WriteLine("Withdraw Amount:");
                    var amountToWithdraw = int.Parse(Console.ReadLine());
                    tracker.WithdrawSaving(account, amountToWithdraw);
                    Console.WriteLine($"You now have {account.Saving}");
                    //SaveTransaction(accounts);
                }
                else if (input == "tc")
                {
                    Console.WriteLine("Transfer Amount:");
                    var amtToTransToChecking = int.Parse(Console.ReadLine());
                    tracker.TransferToChecking(account, amtToTransToChecking);
                    Console.WriteLine($"new Savings balance: {account.Saving}");
                    Console.WriteLine($"new Checking total: {account.Checking}");
                }
                else if (input == "ts")
                {
                    Console.WriteLine("Transfer Amount:");
                    var amtToTransToSaving = int.Parse(Console.ReadLine());
                    tracker.TransferToSaving(account, amtToTransToSaving);
                    Console.WriteLine($"new checking balance: {account.Checking}");
                    Console.WriteLine($"new Saving total: {account.Saving}");
                }
                else if (input == "quit")
                {
                    SaveTransaction(accounts);
                    isRunning = false;
                }
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            // download csv package
            //As a user I should be able see the totals in my saving and checking account when the program first starts


            //var userDisplay = accountInfo

            var newAccountTracker = new AccountTracker();
            var Account           = newAccountTracker.AccountReader();

            var bankStatus = true;

            while (bankStatus)
            {
                //foreach (var s in AccountTracker.account) ;

                Console.WriteLine("What is your checking?");
                var checkNumber = Console.ReadLine();
                Console.WriteLine("How much is in your savings");
                var savingsNumber = Console.ReadLine();
                Console.WriteLine("What is your account number?");
                var account = Console.ReadLine();
                Console.WriteLine($"Your totals are 'checking' and 'savings");
                Console.WriteLine($"What would you like to do (withdraw),(deposit), (transfer), (log out)?");
                var bankRequest = Console.ReadLine().ToLower();
                if (bankRequest == "log out")
                {
                    bankStatus = false;
                }
                else if (bankRequest == "withdraw")
                {
                    Console.WriteLine("checking or savings");
                    var accountChoice = Console.ReadLine().ToLower();
                    if (accountChoice == "checking")
                    {
                        Console.WriteLine("how much");
                        var withdrawCheck = Console.ReadLine();
                    }
                    else
                    {
                        Console.WriteLine("how much");
                        var withdrawSaves = Console.ReadLine();
                    }
                }
                else if (bankRequest == "deposit")
                {
                    Console.WriteLine("checking or savings");
                    var accountChoice = Console.ReadLine().ToLower();
                    if (accountChoice == "checking")
                    {
                        Console.WriteLine("how much");
                        var depositCheck = Console.ReadLine();
                    }
                    else
                    {
                        Console.WriteLine("how much");
                        var depositSaves = Console.ReadLine();
                    }
                }
                else if (bankRequest == "transfer")
                {
                }
            }

            //As a user I should be able to deposit funds to my savings account
            //As a user I should be able to deposit funds to my checking account
            //As a user I should be able to withdraw funds to my savings account
            //As a user I should be able to withdraw funds to my checking account
            //As a user I should be able to transfer funds from my checking account to my savings account
            //As a user I should be able to transfer funds from my savings account to my checking accounts
            //The app should save my transactions to file using a standard format. This saving should happen after every transaction
            //The app should load up past transaction from a file on start up.
        }