The Code Gym

ATMApplication

ATM Application

The goal of this application was to simulate the basic processes of an ATM.
This was one of the first C# projects undertaken during my time at Centriq Training.

            
                    bool repeat = true;
                    decimal depositTotal = 0;
                    do
                    {
                        Console.WriteLine("-= Centriq Credit Union =-\n" +
                        "B) Balance\nD) Deposit\nW) Withdrawl\nX) Exit");
                        ConsoleKey userChoice = Console.ReadKey().Key;
                        //Clear the console:
                        Console.Clear();
                        switch (userChoice)
                        {
                            case ConsoleKey.B:
                                Console.WriteLine($"Your balance is: ${depositTotal}");
                                break;
                            case ConsoleKey.D:
                                Console.Clear();
                                repeat = false;
                                Console.Write("How much will you be depositing today?: ");
                                string deposit = Console.ReadLine();
                                decimal depositValue = decimal.Parse(deposit);
                                Console.WriteLine(depositValue.ToString("c") + " is going to be deposited into 8675309.");
                                depositTotal += depositValue;
                                Console.Write("Account Balance: " + depositTotal.ToString("c") + "\n");
                                repeat = true;
                                break;
                            case ConsoleKey.W:
                                Console.Clear();
                                repeat = false;
                                Console.Write("How much will you be withdrawing today?: ");
                                string withdraw = Console.ReadLine();
                                decimal withdrawValue = decimal.Parse(withdraw);
                                Console.WriteLine(withdrawValue.ToString("c") + " is going to be withdrawn from 8675309.");
                                depositTotal -= withdrawValue;
                                Console.Write("Account Balance: " + depositTotal.ToString("c") + "\n");
                                repeat = true;
                                break;
                            case ConsoleKey.X:
                            case ConsoleKey.E:
                                Console.WriteLine("Thank you for your business. ");
                                repeat = false;
                                break;
                            default:
                                Console.WriteLine("That is not a valid response!");
                                break;
                        }
                    } while (repeat);
                
            

The simple processes of the application are broken up within the cases of the switch. Each case represents a different function and everything is saved within that instance of the ATM. This project was created before learing data so there is no database hooked up to it. This application runs purely in a C# Console Window.