Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Programming question (VB.NET)
Closed Thread
Old 01-16-2005, 10:19 PM   #1 (permalink)
CntdwnToExtn's Avatar
 
Monster Techie

Join Date: Jan 2005

Location: Parents Basement

Posts: 1,339

CntdwnToExtn is on a distinguished road

Send a message via MSN to CntdwnToExtn
Default Programming question (VB.NET)

can someone help me with a homework question?
i know that is a huge long shot cause it's programming help over the net.....i'm gonna try to explain it the best i can...

if so...


i'm a second semester, first year programmer in college...so cut some slack if i sound stuipd?? haha, i'm gong for networkin' but i HAVE to take programming the first year for basic programming requirments and it's not going all that well...

i'm makin' a window's application that will calculate a pay check..it figurs out the CPP, Income Tax and Net Pay when you put in the hourly rate and hours worked.
we are using seperate funcions for each calculation (income tax, cpp..etc)
i've got everything done and working except for the net pay.
every time i try to put a formula in that it hink works it doesn't and give me that god **** blue underline!!!!!

here's my code:

Private Function GrossPay(ByVal snghoursworked As Single, ByVal sngrateofpay As Single) As Single
Dim sngtotal As Single

sngtotal = snghoursworked * sngrateofpay
Return sngtotal
End Function

Private Function CalcIncomeTax(ByVal snggrosspay As Single) As Single
Dim sngincometaxdeduct As Single

sngincometaxdeduct = snggrosspay * 0.2
Return sngincometaxdeduct
End Function

Private Function CalcCPP(ByVal snggrosspay As Single) As Single
Dim sngcppdeduct As Single

sngcppdeduct = snggrosspay * 0.1
Return sngcppdeduct
End Function

Private Function CalcNetPay(ByVal snggrosspay As Single, ByVal sngincometaxdeduct As Single, ByVal sngcppdeduct As Single, ByVal sngdisplaygrosspay As Single) As Single

sngdisplaygrosspay = snggrosspay - (sngincometaxdeduct + sngcppdeduct)
Return sngdisplaygrosspay
End Function

Private Sub btnCalcNetPay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalcNetPay.Click
Dim sngGrossPay As Single


sngGrossPay = txtHoursWorked.Text * txtRateofPay.Text
lblGrossPay.Text = Convert.ToString(sngGrossPay)


lblIncomeTax.Text = Convert.ToString(CalcIncomeTax(sngGrossPay))
lblCPP.Text = Convert.ToString(CalcCPP(sngGrossPay))
lblNetPay.Text =




End Sub
End Class

???


forgot to mention option strict off
CntdwnToExtn is offline  
Old 01-17-2005, 01:33 AM   #2 (permalink)
CntdwnToExtn's Avatar
 
Monster Techie

Join Date: Jan 2005

Location: Parents Basement

Posts: 1,339

CntdwnToExtn is on a distinguished road

Send a message via MSN to CntdwnToExtn
Default

ugh....oh well......
__________________
CntdwnToExtn is offline  
Old 01-17-2005, 05:31 PM   #3 (permalink)
 
Wizard Techie

Join Date: Apr 2004

Posts: 3,248

killians45

Default

why are you converting to string and not integer? or, if needed, long? also (this is via cimbasic) have you tried assigning the text box a variable and set the variable of the text box to its value when a expression is updates, say the button calc is pushed (they'll need to be public variables)
__________________
If you argue with an idiot he will drag you down to his level and beat you with experience.

I am not a fast writer.
I am not a slow writer.
I am a half-fast writer.

-Robert Asprin
killians45 is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On