Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » .NET General

Post new topic   Reply to topic
multiple wages calculation
View previous topic :: View next topic  
Author Message
nivritchari
Newbie


Joined: 04 Apr 2006
Posts: 2
Location: London

PostPosted: Apr 4th, 2006 04:34 AM    Post subject: multiple wages calculation Reply with quote

Hi
I am trying to build a wage system. Here is my code. could anyone please help how can I calculate multiple employees wages without exiting the program using simple loop:

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Total.Click
Dim HoursWorked As Integer
Dim OvertimeHoursWorked As Integer
Dim HourlyRate As Single
Dim OvertimePay As Single
Dim TotalPay As Single
Dim Message As String

HoursWorked = TextBox1.Text
HourlyRate = ListBox1.Text
If CheckBox1.Checked = True Then
OvertimeHoursWorked = TextBox2.Text
OvertimePay = OvertimeHoursWorked * (2 * HourlyRate) 'calculates overtime
TotalPay = HoursWorked * HourlyRate + OvertimePay 'calculate total pay
Message = "Basic hours worked:" & HoursWorked & vbNewLine 'print basic hours worked
Message = Message & " Hourly rate of Pay:" & Format(HourlyRate, "Currency") & vbNewLine ' prints hourly rate
Message = Message & "Basic pay:" & Format(HourlyRate * HoursWorked, "Currency") & vbNewLine 'prints basic pay
Message = Message & "Overtime Hours Worked:" & OvertimeHoursWorked & vbNewLine 'prints number of overtime hours worked
Message = Message & "Overtime hourly pay rate:" & Format(HourlyRate * 2, "Currency") & vbNewLine 'prints overtime hourly rate
Message = Message & "Overtime pay:" & Format(OvertimePay, "Currency") & vbNewLine 'prints overtime pay
Message = Message & "Total pay:" & Format(TotalPay, "Currency") ' prints total pay
MsgBox(Message, , "Pay Calculation")
Label1.Text = Format(TotalPay, "Currency")
Else
TotalPay = HoursWorked * HourlyRate ' prints total pay
Message = "Basic hours Worked:" & HoursWorked & vbNewLine 'prints basic hours worked
Message = Message & "Hourly rate of pay:" & Format(HourlyRate, "Currency") & vbNewLine ' prints hourly rate of pay
Message = Message & "Basic pay:" & Format(HourlyRate * HoursWorked, "Currency") & vbNewLine 'prints basic pay
Message = (Message & "Total pay;" & Format(TotalPay, "Currency")) 'prints total pay
MsgBox(Message)
End If

End Sub

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
Label2.Visible = True
Else
Label2.Visible = False
End If

End Sub
End Class
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » .NET General All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic