|
-
Apr 30th, 2005, 09:04 PM
#1
Thread Starter
New Member
Help with code, please?! :)
Hi everyone! I'm new to this forum and to Visual Basic. I don't know much about the language let alone any other language for that matter, but I'm learning. I'm taking this class and we have our 4th and final assignment due on Tuesday and I'm looking to see if anyone can give any insight to see what I'm doing wrong. I'm not asking anyone to do my homework for me, I have my code written out and my programs seem to run fine, but in the end i'm not getting the numbers I should... this is what I mean.
We have to calculate the Net Pay of an employee of a company (Jackson's Jelly Beans, don't ask, it's what the professor used) LOL
And anyway, the way she has us do this is by having 2 input boxes: 1 for number of hours worked, and 2 for hourly rate
Gross Pay is calculated as Number of Hours Worked multiplied by Hourly Rate
and
Payroll Tax is calculated as follows: (and we have a chart)
Gross Pay Payroll Tax
Less than 100 0
$100 - $400.99 4% of Gross Pay greater than $100
$401 - $700.99 $10 plus 6% of Gross Pay greater than $400
More than $701 $28 plus 8% of Gross Pay greater than $700
and then she tells us that Net pay is calculated as Gross Pay minus Payroll Tax (I think this is where I go wrong)
My code so far is:
Option Explicit
Public Const ApplicationTitle = "Jackson's Jelly Beans"
Public Sub Assignment4()
Dim intHours As Integer
Dim intRate As Integer
Dim curGross As Currency
Dim intTax As Integer
intHours = InputBox("Enter Number of Hours Worked", ApplicationTitle, Default:=0)
intRate = InputBox("Enter Hourly Rate", ApplicationTitle, Default:=0)
CurGross = intHours * intRate
Select Case curGross
Case Is <= 100
intTax = 0
Case Is <= 400.99
intTax = 0.04 * curGross
Case Is <= 700.99
intTax = 10 + 0.06 * curGross
Case Else
intTax = 28 + 0.08 * curGross
End Select
MsgBox "Net Pay =" & FormatCurrency(curGross)
End Sub
...so again if anyone can maybe just guide me or point out to me what you think I did wrong. We get some values to try to input into our program to see if we did it right, and although my numbers come up close they don't match, so I know I'm right on the edge of this somewhere. I would love any help I can get. Thank you so much!!!!
~Jill
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|