by David Wafula (1 Submission)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 24th March 2011
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
The wage calculator uses the IF statement. It outputs for you the total wage of a man who is paid at an hourly rate or $8 per hour for the
API Declarations
Dim a As Integer
Dim j As Integer
Dim k As Integer
Dim l As Integer
Dim r1 As Integer
Dim r2 As Integer
Dim r3 As Integer
Dim h1 As Integer
Dim h2 As Integer
Dim h3 As Integer
Dim w1 As Integer
Dim w2 As Integer
Dim w3 As Integer
Dim wage As Integer
r2 = (r1 * 1.5)
r3 = (r1 * 2)
a = Val(txtHW.Text)
'Validation of the input textboxes
If txtNames.Text = "" Then
'message to be displayed when there is no name entered
MsgBox "Please enter the Names to Continue", vbOKOnly
txtNames.SetFocus
ElseIf Val(txtHW.Text) <= 0 Then
'Message to be displayed when the hours textbox is not correctly entered
MsgBox "Hours Worked Not Correctly entered", vbOKOnly
txtHW.SetFocus
End If
'code to be executed if the hour input is more than 60
If a > 60 Then
k = (a - 60)
j = a - (k + 35)
i = a - (k + 25)
w1 = (i * r1) + (j * r2) + (k * r3)
wage = w1 + w2 + w3
txtWage.Text = wage
'code to be executed when the hour input is between 36 and 60
ElseIf (a > 35) And (a <= 60) Then
h2 = (a - 35)
h1 = (a - h2)
w2 = (h1 * r1) + (h2 * r2)
wage = w1 + w2 + w3
txtWage.Text = wage
'code to be executed if the hour input is 35 and below
ElseIf a <= 35 Then
w3 = (a * r1)
wage = w1 + w2 + w3
txtWage.Text = wage
End If
End Sub
Private Sub CmdExit_Click()
Unload Me
End Sub
Private Sub CmdNew_Click()
txtNames.SetFocus
txtNames.Text = ""
txtHW.Text = ""
txtWage.Text = ""
End Sub
No comments have been posted about The wage calculator uses the IF statement. It outputs for you the total wage of a man who is paid a. Why not be the first to post a comment about The wage calculator uses the IF statement. It outputs for you the total wage of a man who is paid a.