Public Class Form1
Private Sub xExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xExitButton.Click
Me.Close()
End Sub
Private Sub clearLabels(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xNameTextBox.TextChanged, xSingleRadioButton.Click, xMarriedRadioButton.Click, xHourListBox.SelectedValueChanged, xRateListBox.SelectedValueChanged, xAllowComboBox.TextChanged
xGrossDisplayLabel.Text = ""
xFwtDisplayLabel.Text = ""
xFicaDisplayLabel.Text = ""
xNetDisplayLabel.Text = ""
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Dim button As DialogResult
button = MessageBox.Show("Are you sure you want to quit?", "Please Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1)
If button = Windows.Forms.DialogResult.No Then
e.Cancel = True
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For i As Double = 0 To 55 Step 0.5
xHourListBox.Items.Add(i)
Next
xHourListBox.SelectedItem = 40.0
For j As Decimal = 7.5 To 15.5 Step 0.5
xRateListBox.Items.Add(j)
Next
xRateListBox.SelectedItem = 9.5D
For k As Integer = 0 To 10 Step 1
xAllowComboBox.Items.Add(k)
Next
xAllowComboBox.SelectedItem = 0
End Sub
Private Sub xCalcButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xCalcButton.Click
Dim allowances As Integer
Dim allowance As Integer
Dim allowancesOk As Boolean
Dim hour As Double
Dim hourOk As Boolean
Dim rate As Decimal
Dim rateOk As Boolean
Dim gross As Decimal
Dim fwt As Decimal
Dim fica As Decimal
Dim netpay As Decimal
Dim mStatus As String
allowance = xAllowComboBox.SelectedItem
allowancesOk = Integer.TryParse(xAllowComboBox.Text, allowances)
hour = xHourListBox.SelectedItem
rate = xRateListBox.SelectedItem
If allowancesOk = True Then
hourOk = Integer.TryParse(xHourListBox.Text, hour)
rateOk = Integer.TryParse(xRateListBox.Text, rate)
If xSingleRadioButton.Checked = True Then
mStatus = "S"
Else
mStatus = "M"
End If
If hour <= 40 Then
gross = hour * rate
Else
gross = 40 * rate + (hour - 40) * rate * 1.5
End If
Call GetFWT(
'What are the proper things to insert into this parameter?
fwt = GetFWT(gross, allowance, mStatus)
fica = gross * 0.0765
gross = Math.Round(gross, 2)
fwt = Math.Round(fwt, 2)
fica = Math.Round(fica, 2)
netpay = gross - fwt - fica
Else
MessageBox.Show("Please re-enter the allowances", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
End If
xGrossDisplayLabel.Text = gross.ToString("C2")
xFwtDisplayLabel.Text = fwt.ToString("C2")
xFicaDisplayLabel.Text = fica.ToString("C2")
xNetDisplayLabel.Text = netpay.ToString("C2")
End Sub
Private Function GetFWT(ByVal grosspay As Decimal, ByVal allowances As Integer, ByVal mStatus As String) As Decimal
Dim wage As Decimal
Dim tax As Decimal
wage = grosspay - allowances * 63.46
If mStatus = "S" Then
Select Case wage
Case Is <= 51
tax = 0
Case Is <= 192
tax = 0.1 * (wage - 51)
Case Is <= 620
tax = 14.1 + 0.15 * (wage - 192)
Case Is <= 1409
tax = 78.3 + 0.25 * (wage - 620)
Case Is <= 3013
tax = 275.55 + 0.28 * (wage - 1409)
Case Is <= 6508
tax = 1878.02 + 0.33 * (wage - 3013)
Case Is > 6508
tax = 1878.02 + 0.35 * (wage - 6508)
End Select
Else
Select Case wage
Case Is <= 154
tax = 0
Case Is <= 440
tax = 0.1 * (wage - 154)
Case Is <= 1308
tax = 28.6 + 0.15 * (wage - 440)
Case Is <= 2440
tax = 158.8 + 0.25 * (wage - 1308)
Case Is <= 3759
tax = 441.8 + 0.28 * (wage - 2440)
Case Is <= 6607
tax = 811.12 + 0.33 * (wage - 3759)
Case Is > 6607
tax = 1750.96 + 0.35 * (wage - 6607)
End Select
End If
Return tax
End Function
End Class
Call Function Parameter Data
Page 1 of 12 Replies - 220 Views - Last Post: 03 February 2012 - 02:15 PM
Topic Sponsor:
#1
Call Function Parameter Data
Posted 03 February 2012 - 01:41 PM
I have had some trouble on what to put inside the parameter named CallFWT as without it i would get a value of 0
Replies To: Call Function Parameter Data
#2
Re: Call Function Parameter Data
Posted 03 February 2012 - 02:02 PM
Since it is a function you don't use Call GetFWT(), this is the use for a function:
Are you debugging your work and checking the variables?
fwt = GetFWT(gross, allowance, mStatus)
Are you debugging your work and checking the variables?
#3
Re: Call Function Parameter Data
Posted 03 February 2012 - 02:15 PM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|