clsaccount.txt

来自「BEA WebLogic Server 8.1大全 = BEA webLogic」· 文本 代码 · 共 112 行

TXT
112
字号
Option Explicit

Private mstrAccountNames(1 To 100) As String
Private mdblAccountBalances(1 To 100) As Double

Public Property Get AccountNames()
    AccountNames = mstrAccountNames

End Property
Public Property Get AccountBalances()
    AccountBalances = mdblAccountBalances

End Property

Public Function Create(accountName As String, amount As Double) As Integer

    Dim index As Integer
    Dim flag As Boolean
    index = 1
            
    Do While (True)
        If mstrAccountNames(index) = "" Then
            Create = index
            mstrAccountNames(index) = accountName
            mdblAccountBalances(index) = amount
            Exit Do
        End If
        index = index + 1
        If index > 100 Then
            Exit Do
        End If
    Loop
    
End Function
Public Function Remove(accountName As String) As Integer

    Dim index As Integer
    Dim flag As Boolean
    index = 1
            
    Do While (True)
        If mstrAccountNames(index) = accountName Then
            Remove = index
            mstrAccountNames(index) = ""
            mdblAccountBalances(index) = 0
            Exit Do
        End If
        index = index + 1
        If index > 100 Then
            Exit Do
        End If
    Loop
    
End Function
Public Function Deposit(accountName As String, amount As Double) As Integer

    Dim index As Integer
    Dim flag As Boolean
    index = 1
            
    Do While (True)
        If mstrAccountNames(index) = accountName Then
            Deposit = index
            mdblAccountBalances(index) = mdblAccountBalances(index) + amount
            Exit Do
        End If
        index = index + 1
        If index > 100 Then
            Exit Do
        End If
    Loop
    
End Function
Public Function Withdrawal(accountName As String, amount As Double) As Integer

    Dim index As Integer
    Dim flag As Boolean
    index = 1
            
    Do While (True)
        If mstrAccountNames(index) = accountName Then
            Withdrawal = index
            mdblAccountBalances(index) = mdblAccountBalances(index) - amount
            Exit Do
        End If
        index = index + 1
        If index > 100 Then
            Exit Do
        End If
    Loop
    
End Function
Public Function GetAccountBalance(accountName As String) As Double

    Dim index As Integer
    Dim flag As Boolean
    index = 1
            
    Do While (True)
        If mstrAccountNames(index) = accountName Then
            GetAccountBalance = mdblAccountBalances(index)
            Exit Do
        End If
        index = index + 1
        If index > 100 Then
            Exit Do
        End If
    Loop
    
End Function

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?