Ejemplo n.º 1
0
        public void withDraw()
        {
            Atm a  = new Atm();
            int ch = 0;

            Console.WriteLine("Enter the PIN");
            pin = Convert.ToInt32(Console.ReadLine());
            if (pin != sav_pin)
            {
                Console.WriteLine("Incorrect PIN");
            }
            else
            {
                Console.WriteLine("Enter the amount to withdraw");
                int withAmount = Convert.ToInt32(Console.ReadLine());
                if (withAmount % 100 == 0)
                {
                    ch = Acc_type();
                    switch (ch)
                    {
                    case 1:
                        if (withAmount > curr_balance)
                        {
                            Console.WriteLine("Withdraw Amount exceeds balance");
                        }
                        else
                        {
                            Amt(withAmount);
                            Console.WriteLine("Collect the Money and Card");
                            curr_balance = Math.Round((double)curr_balance - withAmount, 2);
                        }
                        break;

                    case 2:
                        if (withAmount > sav_balance)
                        {
                            Console.WriteLine("Withdraw Amount exceeds balance");
                        }
                        else
                        {
                            Amt(withAmount);
                            Console.WriteLine("Collect the Money and Card");
                            sav_balance = Math.Round((double)sav_balance - withAmount, 2);
                        }
                        break;

                    default:
                        Console.WriteLine("Enter valid choice");
                        break;
                    }
                }
                else
                {
                    Console.WriteLine("Enter amount in multiple of 100");
                }
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Atm a = new Atm();

            a.choice();
        }