public void TransferMoney(Customer4 First, Customer4 second, double money)
 {
     if (!BankAccounts[First.CID].Transfer(BankAccounts[second.CID], money))
     {
         Console.WriteLine("Transfer Failed");
     }
 }
 public void Withdraw(Customer4 Customer, double money)
 {
     if (!BankAccounts[Customer.CID].Withdraw(money))
     {
         Console.WriteLine("\t\t\tInsufficient Funds ");
     }
 }
 ////account number only used for getting;
 ///
 public BankAccount4(Customer4 NewCustomer)
 {
     JointHolder   = null;
     account_no   += count++;
     balance       = 0;
     state         = "OPEN";
     interest      = 0.07;
     AccountHolder = NewCustomer;
     Console.WriteLine("Creating an account   ------> done\n");
 } ///default Constructor
示例#4
0
        static void Main()
        {
            BankBranch4 B1 = new BankBranch4("DBS", "Singapore", "Harirpasad");

            Customer4 C1 = new Customer4("hariprasad", "kottarathil", 23);

            B1.AddCustomer(C1);
            B1.AssignAccount(C1);

            Customer4 C2 = new Customer4("Kannan", "kottarathil", 25);
            Customer4 C3 = new Customer4("dsadas", "kottarathil", 54);
            Customer4 C4 = new Customer4("gfdgdf", "kottarathil", 90);
            Customer4 C5 = new Customer4("vcxv", "kottarathil", 78);
            Customer4 C6 = new Customer4("plplp", "kottarathil", 12);


            B1.AddCustomer(C2);
            B1.AddCustomer(C3);
            B1.AddCustomer(C4);
            B1.AddCustomer(C5);
            B1.AddCustomer(C6);

            /*
             *  FIRST WE WANT TO CREATE BANK BRANCH
             *  USING THAT BRANCH CREATE CLIENTS ACCORDINGLY
             *  SO BANK BRANCH IS ALWAYS THE PARENT OBJECT
             *     BANK-BRANCH.FUNCTION ----THIS SHOULD BE THE IMPLEMENTATION
             *
             *  EACH CUSTOMER IS ASSIGNED TO SEPERATE ACCOUNTS
             *  REFER FUNTION DEFINISTION FOR BETTER UNDERSTANDING
             */

            B1.AssignAccount(C2);
            B1.AssignAccount(C3);


            B1.Deposite(C1, 500);
            B1.Deposite(C2, 6980);
            B1.CreditInterest(C1);

            B1.PrintAllCustomer();
            B1.PrintAllAccountDetails();

            B1.TransferMoney(C1, C2, 65);
            B1.PrintAllAccountDetails();
        }
        } ///default Constructor

        public void addJoint(Customer4 NewCustomer)
        {
            JointHolder = NewCustomer;
            Console.WriteLine("Converting as Joint account   ------> done\n");
        }
        public double GetBalance(Customer4 Customer)
        {
            double result = BankAccounts[Customer.CID].Balance;

            return(result);
        }
 public void addJointAccount(Customer4 newCustomer, Customer4 oldCustomer) //the new person and the object of the corresponsing account
 {
     BankAccounts[oldCustomer.CID].addJoint(newCustomer);
     //storing the new customer in to the account of old customer as joint account
 }
 public void AssignAccount(Customer4 newCustomer) //assigning cutor with a new bank account
 {
     BankAccounts[newCustomer.CID] = new BankAccount4(newCustomer);
 }
 public void AddCustomer(Customer4 newCustomer)
 {
     Customers[newCustomer.CID] = newCustomer;
 }
 public void PrintCustomerData(Customer4 customer)
 {
     BankAccounts[customer.CID].PrintAccountData();
 }
 public void CreditInterest(Customer4 customer)
 {
     BankAccounts[customer.CID].CreditInterest();
 }
 public void Deposite(Customer4 Customer, double money)
 {
     BankAccounts[Customer.CID].Deposite(money);
 }