ption Explicit On
Option Strict On
Public Class MainForm
Private Function CalcResidentialTotalDue() As Decimal
' calculates and returns the total due for a residential customer
' declare constants and variables
Const ResidentialProcessing As Decimal = 4.5D
Const ResidentialBasic As Decimal = 30D
Const ResidentialPremium As Decimal = 5D
Dim premiumChannels As Decimal
Dim charge As Decimal
' residential customers do not have connections
connectionListBox.SelectedIndex = 0
' get number of premium channels
premiumChannels = Convert.ToDecimal(premiumListBox.SelectedItem)
' calculate total due
charge = ResidentialProcessing + ResidentialBasic _
+ ResidentialPremium * premiumChannels
' return the total due
Return charge
End Function
Private Function CalcBusinessTotalDue() As Decimal
' calculates and returns the total due for a business customer
' declare constants and variables
Const BusinessProcessing As Decimal = 16.5D
Const BusinessFirst10Connections As Decimal = 80D
Const BusinessAdditionalConnections As Decimal = 4D
Const BusinessPremiumChannel As Decimal = 50D
Dim connections As Decimal
Dim premiumChannels As Decimal
Dim charge As Decimal
Dim businessBasic As Decimal
' get number of connections
connections = Convert.ToDecimal(connectionListBox.SelectedItem)
' business customers must have at least one connection
If connections = 0 Then
MessageBox.Show("The number of connections must be greater than 0.", _
"Cable Direct", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
' get number of premium channels
premiumChannels = Convert.ToDecimal(premiumListBox.SelectedItem)
' calculate the basic service
If connections <= 10D Then
businessBasic = BusinessFirst10Connections
Else
businessBasic = BusinessFirst10Connections _
+ (connections  10D) * BusinessAdditionalConnections
End If
' calculate the total due
charge = BusinessProcessing + businessBasic _
+ BusinessPremiumChannel * premiumChannels
End If
' return the total due
Return charge
End Function
Private Sub ClearTotalDue(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles businessRadioButton.Click, residentialRadioButton.Click, _
premiumListBox.SelectedValueChanged, connectionListBox.SelectedValueChanged
totalDueLabel.Text = String.Empty
End Sub
Private Sub MainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' fills the list boxes with values, then selects the first value
For premiumChannel As Integer = 0 To 20
premiumListBox.Items.Add(premiumChannel.ToString)
Next premiumChannel
For connections As Integer = 0 To 100
connectionListBox.Items.Add(connections.ToString)
Next connections
premiumListBox.SelectedIndex = 0
connectionListBox.SelectedIndex = 0
End Sub Private Sub calcButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles calcButton.Click
' calculates and displays a customer's bill
Dim totalDue As Decimal
' call appropriate function to calculate the total due
' display the total due
totalDueLabel.Text = totalDue.ToString("C2")
End Sub
Private Sub exitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles exitButton.Click
Me.Close()
End Sub
End Class
OK so I feel stupid ..jere I have written all of this code yet I have forgotten how to call a function to get this to calculate
Someone please remind me
