• Log in or sign up for an account here: https://www.sythe.org/login

need hw help fast

enjoi888

Forum Addict
Banned
Joined
Feb 28, 2007
Sythe Gold
0
Messages
323
Location
east coast
need hw help fast
ok my teacher gave us this program to make

basically he wants us to make a calc that calculates a persons pay based on hours worked, overtime worked, and pay rate and its supposed to calculate the persons pay after their overtime pay is included and then calculate how much tax will b taken out( fed tax=10% state tax =5%) and then their take-home pay after taxs have been taken out and overtime has been added in


i got everything working fine except wen i started working on the taxs part, i guess i might b having trouble with using const's or something

it keeps saying argument expression cant b done or watever

heres my code and pls help fast

Code:
 'Kevin Galloway     September 31,2008


Option Explicit On




Public Class Form1

   



    Private Sub xExitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xExitButton.Click
        Me.Close()
    End Sub




    Private Sub xResetButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xResetButton.Click

        Me.xRegHourTextbox.Text = String.Empty
        Me.xOverHourTextbox.Text = String.Empty
        Me.xPayRateTextbox.Text = String.Empty
        Me.xRegPayTextbox.Text = String.Empty
        Me.xOverPayTextbox.Text = String.Empty
        Me.xGrossPayTextbox.Text = String.Empty
        Me.xFedTaxTextbox.Text = String.Empty
        Me.xStateTaxTextbox.Text = String.Empty
        Me.xNetPayTextbox.Text = String.Empty
        Me.xStateTaxRate.text = String.Empty
        Me.xFedTaxRate.text = String.Empty

    End Sub

    Private Sub xCalculateButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xCalculateButton.Click

        Const xFedTaxRate As Decimal = 0.1D
        Const xStateTaxRate As Decimal = 0.05D
        Dim xRegHourTextbox As Integer
        Dim xOverHourTextbox As Integer
        Dim xPayRateTextbox As Integer
        Dim xGrossPayTextbox As Integer
        Dim xNetPayTextbox As Integer
        Dim xRegPayTextbox As Integer
        Dim xOverPayTextbox As Decimal
        Dim xFedTaxTextbox As Integer
        Dim xStateTaxTextbox As Integer

        Me.xRegPayTextbox.Text = Val(Me.xRegHourTextbox.Text) * Val(Me.xPayRateTextbox.Text)
        Me.xOverPayTextbox.Text = Val(Me.xOverHourTextbox.Text) * Val(Me.xPayRateTextbox.Text) * 1.5
        Me.xGrossPayTextbox.Text = Val(Me.xRegPayTextbox.Text) + Val(Me.xOverPayTextbox.Text)
        Me.xFedTaxTextbox.Text = Val(Me.xGrossPayTextbox.Text) * Val(Me.xFedTaxRate)


    End Sub
End Class
 
need hw help fast
I haven't touched .Net in over 3 years and I don't have a test environment right now but I'll take a stab at what might be the problem..

Code:
   Me.xRegPayTextbox.Text = Val(Me.xRegHourTextbox.Text) * Val(Me.xPayRateTextbox.Text)
        Me.xOverPayTextbox.Text = Val(Me.xOverHourTextbox.Text) * Val(Me.xPayRateTextbox.Text) * 1.5
        Me.xGrossPayTextbox.Text = Val(Me.xRegPayTextbox.Text) + Val(Me.xOverPayTextbox.Text)
        Me.xFedTaxTextbox.Text = Val(Me.xGrossPayTextbox.Text) * Val(Me.xFedTaxRate)
I think your error lies on the line below. Since xFedTaxRate is just a varaiable and not a component on your form I don't think it should be referenced to through the "Me" keyword which is implying that it's an element on the current form. Also it's already a number so no need to use the Val() function even?

Code:
Me.xFedTaxTextbox.Text = Val(Me.xGrossPayTextbox.Text) * Val(Me.xFedTaxRate)

should be...

Code:
Me.xFedTaxTextbox.Text = Val(Me.xGrossPayTextbox.Text) * xFedTaxRate
 
need hw help fast
tysm null

i was making it way too complicated

got the hw done
 
Runescape Gamblingrunescape gambling
Back
Top