Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact
A1VBCode Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      

Home » .NET Programming » Visual Basic .NET/2005/2008 » Need Help With VB Code please...SOLVED.


Need Help With VB Code please...SOLVED.Expand / Collapse
Author
Message
Posted 10/10/2008 9:27:20 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 10/11/2008 3:06:27 AM
Posts: 1, Visits: 5
This is what I need to do:

This program will calculate net pay for a company that has employees in two
states (Ohio, West Virginia). The tax rate in Ohio is 5% and the tax rate in West
Virginia is 4%.
Define 4 text boxes, the 1st to accept hours worked, the 2nd the pay rate per hour,
and the 3rd the state the employee worked in (assume all hours worked were in
one state).
If the employee worked over 40 hours, all hours over 40 are overtime hours paid
at time and a half (rate * 1.5).
The state input should be the abbreviation (Ohio – OH, West Virginia – WV and
the user should be able to enter the any combination of case for those
abbreviations (OH, Oh, oH, oh) and the program will recognize the abbreviation.
If the user enters an illegal state abbreviation (any letter pair other than OH and
WV) the program will display an error message in the Net Pay text box and return
the user to the State text box to correct the error.
Format Net Pay as currency in the output text box

This is what my code looks like right now:

Public Class Program4
Const C1 = 0.05
Const C2 = 0.04
Dim C3, C4 As Integer
Dim S1 As String
Dim T As Single
C3 = Integer.Parse(Me.Time.Text)
C4 = Integer.Parse(Me.Tbox2.Text)

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
Private Sub Tbox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tbox3.TextChanged
S1 = Me.Tbox3.Text
If S1 = "OH" Then T = C1
If S1 = "WV" Then T = C2
If S1 <> "OH" Or S1 <> "WV" Then 'Finish this
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim C5, C6, C7, C8, C9, C10, C11 As Single
Dim S2, S3, OutStr As String
If C3 <= 40 Then
C5 = C3 * C4 And C6 = C5 * T And C7 = C5 - C6 And S2 = Convert.ToString(C7)
Else
C8 = C3 - 40
C9 = C8 * (C4 * 1.5) + (40 * C4)
C10 = C9 * T
C11 = C9 - C10
S3 = Convert.ToString(C11)
Me.Pay.Text = S3

End If
End Sub
End Class

Figured it out . Someone please delete this thread. THanks!
Post #25961
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Brian, Peter

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 11:40am