Public Class frmExQ6
' Compute Bank Balance
' by <Your Name>
' compiled using MS Visual Studio 2010
' tested on an Intel Xeon PC running MS Windows 7
' CS 115 Section <A or D>
' May 17, 2013
' This program will compute the bank balance after subtracting the total of 5 bills
' starting with a $2000 balance.
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
Const dblBEGINNING_BALANCE As Double = 2000.0 'Beginning balance
Dim dblTotBills As Double = 0.0 'Total of bills
Dim dblBalance As Double 'Balance = beginning balance - total of bills
AddBillsToList() 'Add bills to the List Box
ComputeBillTotal(dblTotBills) 'Compute total of bills
dblBalance = ____________________ - ___________ 'Compute the balance
lblOut.Text = dblBalance.ToString("c") 'Display balance in label as currency
End Sub
Private Sub AddBillsToList()
'-----------------------------
'Procedure to Add bills to the List Box
'-----------------------------
Dim intCount As Integer 'For Loop Counter
Dim strValue As String 'Storage for input
ClearAll() 'Clear list box and total
'-----------------------------
' For loop to add 5 items to List Box
'-----------------------------
For ______________________
strValue = InputBox("Enter amount for Bill " & intCount + 1, "Bill Entry")
'-----------------------------
'edit input - ensure value is numeric
'-----------------------------
If ___________________ Then 'If input is numeric
lstBills.Items.___(strValue) 'Add value to List Box
Else
MessageBox.Show("Please enter a numeric value")
intCount -= 1 'Set counter down for re-entry at same spot
End If
Next
End Sub
Private Sub ComputeBillTotal(By___ dblVal As Double)
'-----------------------------
'Procedure to total the bills -
'parameter must be passed "By____" so original value passed is changed
'-----------------------------
Dim intX As Integer = 0 'Counter for Do While Loop
Do __________________________________ 'Do loop
dblVal += CDbl(lstBills.___________) 'Convert list box entry to double and add to total
intX += 1 'Increment counter
Loop
End Sub
Private Sub ClearAll()
'-----------------------------
'Procedure to clear List Box and Label
'-----------------------------
lstBills.Items.________() 'Clear List Box
lblOut.Text = String.________ 'Clear Output Label
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class
' Compute Bank Balance
' by <Your Name>
' compiled using MS Visual Studio 2010
' tested on an Intel Xeon PC running MS Windows 7
' CS 115 Section <A or D>
' May 17, 2013
' This program will compute the bank balance after subtracting the total of 5 bills
' starting with a $2000 balance.
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
Const dblBEGINNING_BALANCE As Double = 2000.0 'Beginning balance
Dim dblTotBills As Double = 0.0 'Total of bills
Dim dblBalance As Double 'Balance = beginning balance - total of bills
AddBillsToList() 'Add bills to the List Box
ComputeBillTotal(dblTotBills) 'Compute total of bills
dblBalance = ____________________ - ___________ 'Compute the balance
lblOut.Text = dblBalance.ToString("c") 'Display balance in label as currency
End Sub
Private Sub AddBillsToList()
'-----------------------------
'Procedure to Add bills to the List Box
'-----------------------------
Dim intCount As Integer 'For Loop Counter
Dim strValue As String 'Storage for input
ClearAll() 'Clear list box and total
'-----------------------------
' For loop to add 5 items to List Box
'-----------------------------
For ______________________
strValue = InputBox("Enter amount for Bill " & intCount + 1, "Bill Entry")
'-----------------------------
'edit input - ensure value is numeric
'-----------------------------
If ___________________ Then 'If input is numeric
lstBills.Items.___(strValue) 'Add value to List Box
Else
MessageBox.Show("Please enter a numeric value")
intCount -= 1 'Set counter down for re-entry at same spot
End If
Next
End Sub
Private Sub ComputeBillTotal(By___ dblVal As Double)
'-----------------------------
'Procedure to total the bills -
'parameter must be passed "By____" so original value passed is changed
'-----------------------------
Dim intX As Integer = 0 'Counter for Do While Loop
Do __________________________________ 'Do loop
dblVal += CDbl(lstBills.___________) 'Convert list box entry to double and add to total
intX += 1 'Increment counter
Loop
End Sub
Private Sub ClearAll()
'-----------------------------
'Procedure to clear List Box and Label
'-----------------------------
lstBills.Items.________() 'Clear List Box
lblOut.Text = String.________ 'Clear Output Label
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class