static void Main(string[] args) { Acc a = new Acc(); a.AccName = "Anjuman"; a.AccId = "39015"; a.Balance = 20000; a.Deposite(5000); a.Withdraw(2000); a.Transfer(100000, a); a.ShowInfo(); }
public void Transfer(int amount, Acc receiver) { Console.WriteLine("Enter amount to transfer"); amount = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter The reciever Account id"); receiver.AccId = Console.ReadLine(); if (balance > amount) { balance -= amount; Console.WriteLine("Amount" + amount + "Transfered to" + receiver); } else { Console.WriteLine("Invalid Transaction"); } }