Mzsmunna
10/16/2019 - 1:47 PM

Account


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Account
    {
        string accountName;
        string accountID;
        double balance;

        public Account()
        {
            accountName = "";
            accountID = "";
            balance = 0.0;
        }

        public string AccountName
        {
            set
            {
                this.accountName = value;
            }
            get
            {
                return this.accountName;
            }
        }

        public string AccountID
        {
            set
            {
                this.accountID = value;
            }
            get
            {
                return this.accountID;
            }
        }

        public double Balance
        {
            set
            {
                this.balance = value;
            }
            get
            {
                return this.balance;
            }
        }

        public void Deposit(double amount)
        {
            System.Console.WriteLine(amount+"Tk has been deposited to the Account Successfully! ");
            double amnt1;
            amnt1 = this.Balance;
            amnt1 = amnt1 + amount;
            this.Balance = amnt1;
            System.Console.WriteLine("Current Balance is : "+this.Balance);
        }

        public void Withdraw(double amount)
        {
            System.Console.WriteLine(amount + "Tk has been withdrawn Successfully! ");
            double amnt1;
            amnt1 = this.Balance;
            amnt1 = amnt1 - amount;
            this.Balance=amnt1;
            System.Console.WriteLine("Current Balance is : " + this.Balance);
        }

        public void Transfer(double amount, Account id)
        {
            System.Console.WriteLine(amount + "Tk has been transfered to the Account " + id.AccountName + " Successfully! ");
            double amnt1, amnt2;
            amnt1 = id.Balance;
            amnt2 = this.Balance;
            amnt2 = amnt2 - amount;
            amnt1 = amnt1 + amount;
            id.Balance = amnt1;
            this.Balance = amnt2;
            System.Console.WriteLine("Current Balance of " + this.AccountName + " is : " + this.Balance);
            System.Console.WriteLine("Current Balance of " + id.AccountName + " is : " + id.Balance);
        }
    }
}