I'm creating a sales commission application. I have to use a Select....Case statement to implement the sales commission schedule. When the calculate button is clicked, three methods should be called. One to calculate gross sales, one to calcuate the commission percentage based on the commission schedule and one to calculate the sale's persons earnings. When i press the calculate button, my gross sales display, but the sales persons commission percentage and the sales persons earnings just display as zero....
Public Class SalesCommission
'stores total of sales person earnings
Dim salesEarnings As Decimal
Dim commTotal As Decimal
Dim items As Integer
Private Property grossSales As Integer
Private Property commpercentage As String
'calculate and display number of items sold
Public Sub calculateButton_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles calculateButton.Click
'get number of items
items = Convert.ToInt16(Val(ItemsSoldTextBox.Text))
'Obtain gross sales
Dim grossSales As Decimal = CalculateItems()
Dim commTotal As Decimal = CommissionTotal()
Dim commPercentage As Decimal = commPerc()
' display gross sales
grossOutputLabel.Text = String.Format("{0:C}", grossSales)
' display total commission
salesOutputLabel.Text = String.Format("{0:C}", commTotal)
' display commission percentage
commOutputLabel.Text = String.Format(commPercentage & "%")
End Sub
' calculates gross sales
Function CalculateItems() As String
grossSales = items * 10
Return grossSales
End Function
' Commission Percentage
Function commPerc() As String
Select Case commpercentage
Case 0 To 50
commpercentage = 6
Case 51 To 100
commpercentage = 7
Case 101 To 150
commpercentage = 8
Case Is >= 151
commpercentage = 9
End Select
Return commpercentage
End Function
Function CommissionTotal() As String
commTotal = (commpercentage * grossSales) / 100
Return commTotal
End Function
End Class