simulate a bank account : Class Definition : Class Interface C# Source Code


Custom Search

C# Source Code » Class Interface » Class Definition »

 

simulate a bank account








    
 
using System;

public class BankAccount {
    public static int nNextAccountNumber = 1000;
    public int nAccountNumber;
    public double dBalance;
    
    public void InitBankAccount() {
        nAccountNumber = ++nNextAccountNumber;
        dBalance = 0.0;
    }

    public void Deposit(double dAmount) {
        if (dAmount > 0.0) {
            dBalance += dAmount;
        }
    }

    public double Withdraw(double dWithdrawal) {
        if (dBalance <= dWithdrawal) {
            dWithdrawal = dBalance;
        }

        dBalance -= dWithdrawal;
        return dWithdrawal;
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Class Interface
» Class Definition