Question: I'm a beginner at computer science, I made the following wage calculator but I have abasolutely no idea how to add overtime into it. The
I'm a beginner at computer science, I made the following wage calculator but I have abasolutely no idea how to add overtime into it.
The full code is below, please give me the code I need to add and where I need to add it. I would very much appreciate it...
Public Class Form1 'Project:Wage Calculator 'Programmer:Mario Garza
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click inputHrsWorked.Clear() inputHourlyPayRate.Clear() answer.Text = String.Empty
inputHrsWorked.Focus()
End Sub
Private Sub input1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles inputHrsWorked.KeyPress If (e.KeyChar < "0" OrElse e.KeyChar > "9") AndAlso e.KeyChar <> "" AndAlso e.KeyChar <> ControlChars.Back Then e.Handled = True MessageBox.Show("Input Integers Only", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error) End If End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles inputHrsWorked.TextChanged
End Sub
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click If inputHrsWorked.Text = "" Or inputHourlyPayRate.Text = "" = True Then MsgBox("Please Enter Required * Information....", MsgBoxStyle.Critical, "Attention...") inputHrsWorked.Focus() Else Dim nhw, hpr, gpe As Double nhw = inputHrsWorked.Text hpr = inputHourlyPayRate.Text gpe = nhw * hpr answer.Text = gpe.ToString("C") End If End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click If MessageBox.Show("Do you want to exit?", "Wage Calculator", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = Windows.Forms.DialogResult.Yes Then Me.Close() Else inputHrsWorked.Focus()
End If End Sub
Private Sub inputHourlyPayRate_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles inputHourlyPayRate.KeyPress If (e.KeyChar < "0" OrElse e.KeyChar > "9") AndAlso e.KeyChar <> "" AndAlso e.KeyChar <> ControlChars.Back Then e.Handled = True MessageBox.Show("Input Integers Only", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error) End If End Sub
Private Sub inputHourlyPayRate_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles inputHourlyPayRate.TextChanged
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing MessageBox.Show("Thank you for using my program...", "Until Next Time", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ToolTip1.SetToolTip(inputHrsWorked, "Input NOH") ToolTip1.SetToolTip(inputHourlyPayRate, "Input RPH") ToolTip1.SetToolTip(btnCalculate, "Calculate Gross Pay") ToolTip1.SetToolTip(btnClear, "Clear") ToolTip1.SetToolTip(btnExit, "Go Away")
End Sub
Private Sub CalculateGrossPayToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateGrossPayToolStripMenuItem.Click btnCalculate_Click(sender, e)
End Sub
Private Sub ClearToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearToolStripMenuItem.Click btnClear_Click(sender, e)
End Sub
Private Sub GoAwayToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GoAwayToolStripMenuItem.Click btnExit_Click(sender, e)
End Sub End Class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
