Hi,
I am building an APP that will accept the hours worked and hourly rate for an employee.
The normal working week is 40 hours, with any additional worked hours classed as overtime.
Overtime is paid as
up to 10 hours above 40 = time and a half
any additional hours so that would be 50 or more hours worked = Double time.
Ive coded this APP and to me it works fine apart from the final amount not being in a cash value.
Could someone look to see if I have gotten the equation correct before I start opening the champagne.
Option Explicit
Private Sub cmdQUIT_Click()
'Terminate Application
End
End Sub
Private Sub cmdStart_Click()
'Declare required storage
Dim Hours_Wrk As Integer
Dim Hourly_Rate As Currency
Dim Total As Currency
Dim Wrk_Wk As Integer
'Invite user to input rate and hours
Hours_Wrk = InputBox("Please input hours worked ", "Hours")
Hourly_Rate = InputBox("Please input rate of pay ", "Rate")
Wrk_Wk = 40
If Hours_Wrk = Wrk_Wk Then
Total = Hours_Wrk * Hourly_Rate
ElseIf Hours_Wrk > Wrk_Wk<= 50 Then
Total = Hours_Wrk * Hourly_Rate * 1.5
Else
If Hours_Wrk > 50 Then
Total = Hours_Wrk * Hourly_Rate * 2
End If
End If
'Display output in pic box
picMessage.Print "The hours worked are " & (Hours_Wrk)
picMessage.Print "The rate per hour is " & (Hourly_Rate)
picMessage.Print "The total pay is " & "£"; (Total)
End Sub
Thanks
Charlie
This message was edited by Charlie on 2002-10-18 12:14
I am building an APP that will accept the hours worked and hourly rate for an employee.
The normal working week is 40 hours, with any additional worked hours classed as overtime.
Overtime is paid as
up to 10 hours above 40 = time and a half
any additional hours so that would be 50 or more hours worked = Double time.
Ive coded this APP and to me it works fine apart from the final amount not being in a cash value.
Could someone look to see if I have gotten the equation correct before I start opening the champagne.
Option Explicit
Private Sub cmdQUIT_Click()
'Terminate Application
End
End Sub
Private Sub cmdStart_Click()
'Declare required storage
Dim Hours_Wrk As Integer
Dim Hourly_Rate As Currency
Dim Total As Currency
Dim Wrk_Wk As Integer
'Invite user to input rate and hours
Hours_Wrk = InputBox("Please input hours worked ", "Hours")
Hourly_Rate = InputBox("Please input rate of pay ", "Rate")
Wrk_Wk = 40
If Hours_Wrk = Wrk_Wk Then
Total = Hours_Wrk * Hourly_Rate
ElseIf Hours_Wrk > Wrk_Wk<= 50 Then
Total = Hours_Wrk * Hourly_Rate * 1.5
Else
If Hours_Wrk > 50 Then
Total = Hours_Wrk * Hourly_Rate * 2
End If
End If
'Display output in pic box
picMessage.Print "The hours worked are " & (Hours_Wrk)
picMessage.Print "The rate per hour is " & (Hourly_Rate)
picMessage.Print "The total pay is " & "£"; (Total)
End Sub
Thanks
Charlie
This message was edited by Charlie on 2002-10-18 12:14