Homework Assignment

I don't have any experience programming but am trying to understand. Just stumped right now.
I'm not asking for someone to do it but just need some direction
Public Class Payroll

    Private Sub CloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Close()
    End Sub

    Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
        'Clicking the exit button closes the program
        Close()
    End Sub

    Private Sub CalculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateButton.Click
        ' Declared hourly rate variables
        ' Each variable is intialize according to the employees pay rate

        Dim SeanHourlyRate As Integer = 75
        Dim GeorgeHourlyRate As Integer = 52
        Dim RogerHourlyRate As Integer = 80
        Dim TimothyHourlyRate As Integer = 60
        Dim PierceHourlyRate As Integer = 85
        Dim DanielHourlyRate As Integer = 94

        ' Declared base hourly rate of 40 hours
        ' 40 hours is regular pay

        Dim BaseHourlyRate As Integer = 40

        'Declared variable for hours over regular hours(40 hrs) worked
        '((hours worked input value)- ConstSeanBaseHourlyRate)
        ' Example: 44 hours actual time worked - 40 hours based = 4 OT hrs

        Dim intSeanHoursWorkedOver As Integer
        Dim intGeorgeHoursWorkedOver As Integer
        Dim intRogerHoursWorkedOver As Integer
        Dim intTimothyHoursWorkedOver As Integer
        Dim intPierceHoursWorkedOver As Integer
        Dim intDanielHoursWorkedOver As Integer

        ' Declared overtime payment variable
        ' (Hours worked overtime) x (1.5) x (Employee pay rate)

        Dim DblSeanTotalPaymentOver As Double
        Dim DblGeorgeTotalPaymentOver As Double
        Dim DblRogerTotalPaymentOver As Double
        Dim DblTimothyTotalPaymentOver As Double
        Dim DblPierceTotalPaymentOver As Double
        Dim DblDanielTotalPaymentOver As Double


        ' Declared hours worked variable
        ' Hours worked textboxes input is assigned to variables

        Dim DblSeanHoursWorked As Double
        Dim DblGeorgeHoursWorked As Double
        Dim DblRogerHoursWorked As Double
        Dim DblTimothyHoursWorked As Double
        Dim DblPierceHoursWorked As Double
        Dim DblDanielHoursWorked As Double

        ' Declared total payment variable
        ' The total payment results are assigned to variables

        Dim DblSeanTotalPayment As Double
        Dim DblGeorgeTotalPayment As Double
        Dim DblRogerTotalPayment As Double
        Dim DblTimothyTotalPayment As Double
        Dim DblPierceTotalPayment As Double
        Dim DblDanielTotalPayment As Double

        
        'Assigned textbox input to employee hours worked variable


        DblSeanHoursWorked = System.Convert.ToDouble(SeanConneryHoursWorkedMaskedTextBox.Text)
        DblGeorgeHoursWorked = System.Convert.ToDouble(GeorgeLazenbyHoursWorkedMaskedTextBox.Text)
        DblRogerHoursWorked = System.Convert.ToDouble(RogerMooreHoursWorkedMaskedTextBox.Text)
        DblTimothyHoursWorked = System.Convert.ToDouble(TimothyDaltonHoursWorkedMaskedTextBox.Text)
        DblPierceHoursWorked = System.Convert.ToDouble(PierceBrosnanHoursWorkedMaskedTextBox.Text)
        DblDanielHoursWorked = System.Convert.ToDouble(DanielCraigHoursWorkedMaskedTextBox.Text)


        'Sean Calculation
        'The "If statement"  determines if the Sean worked 40 hours or more
        'The code meets the following requirement: If OT is worked, show the pay in green text.
        'Output goes to a label

        If System.Convert.ToInt16(SeanConneryHoursWorkedMaskedTextBox.Text) <= 40 Then
            DblSeanTotalPayment = SeanHourlyRate * DblSeanHoursWorked
            SeanConneryPaymentLabel.Text = Format(DblSeanTotalPayment, "c").ToString
            SeanConneryPaymentLabel.ForeColor = Color.Black
        Else
            intSeanHoursWorkedOver = (System.Convert.ToInt16(SeanConneryHoursWorkedMaskedTextBox.Text) - BaseHourlyRate)
            DblSeanTotalPayment = SeanHourlyRate * BaseHourlyRate
            DblSeanTotalPaymentOver = intSeanHoursWorkedOver * 1.5 * SeanHourlyRate
            DblSeanTotalPayment = DblSeanTotalPayment + DblSeanTotalPaymentOver
            SeanConneryPaymentLabel.Text = Format(DblSeanTotalPayment, "c").ToString
            SeanConneryPaymentLabel.ForeColor = Color.Green

        End If

        'George's Calculations
        'The "If statement"  determines if the Sean worked 40 hours or more
        'The code meets the following requirement: If OT is worked, show the pay in green text.
        'Output goes to a label

        If System.Convert.ToInt16(GeorgeLazenbyHoursWorkedMaskedTextBox.Text) <= 40 Then
            DblGeorgeTotalPayment = GeorgeHourlyRate * DblGeorgeHoursWorked
            GeorgeLazenbyPaymentLabel.Text = Format(DblGeorgeTotalPayment, "c").ToString
            GeorgeLazenbyPaymentLabel.ForeColor = Color.Black
        Else
            intGeorgeHoursWorkedOver = (System.Convert.ToInt16(GeorgeLazenbyHoursWorkedMaskedTextBox.Text) - BaseHourlyRate)
            DblGeorgeTotalPayment = GeorgeHourlyRate * DblGeorgeHoursWorked
            DblGeorgeTotalPaymentOver = intGeorgeHoursWorkedOver * 1.5 * GeorgeHourlyRate
            DblSeanTotalPayment = DblSeanTotalPayment + DblSeanTotalPaymentOver
            GeorgeLazenbyPaymentLabel.Text = Format(DblGeorgeTotalPayment, "c").ToString
            GeorgeLazenbyPaymentLabel.ForeColor = Color.Green
        End If

        'Timothy's Calculations
        'The "If statement"  determines if the Timothy worked 40 hours or more
        'The code meets the following requirement: If OT is worked, show the pay in green text.
        'Output goes to a label


        If System.Convert.ToInt16(TimothyDaltonHoursWorkedMaskedTextBox.Text) <= 40 Then
            DblTimothyTotalPayment = TimothyHourlyRate * DblTimothyHoursWorked
            TimothyDaltonPaymentLabel.Text = Format(DblTimothyTotalPayment, "c").ToString
            TimothyDaltonPaymentLabel.ForeColor = Color.Black
        Else
            intTimothyHoursWorkedOver = (System.Convert.ToInt16(TimothyDaltonHoursWorkedMaskedTextBox.Text) - BaseHourlyRate)
            DblTimothyTotalPayment = TimothyHourlyRate * DblTimothyHoursWorked
            DblTimothyTotalPaymentOver = intTimothyHoursWorkedOver * 1.5 * TimothyHourlyRate
            DblTimothyTotalPayment = DblTimothyTotalPayment + DblTimothyTotalPaymentOver
            TimothyDaltonPaymentLabel.Text = Format(DblTimothyTotalPayment, "c").ToString
            TimothyDaltonPaymentLabel.ForeColor = Color.Green
        End If

        'Roger's Calculations
        'The "If statement"  determines if the Roger worked 40 hours or more
        'The code meets the following requirement: If OT is worked, show the pay in green text.
        'Output goes to a label

        If System.Convert.ToInt16(RogerMooreHoursWorkedMaskedTextBox.Text) <= 40 Then
            DblRogerTotalPayment = RogerHourlyRate * DblRogerHoursWorked
            RogerMoorePaymentLabel.Text = Format(DblRogerTotalPayment, "c").ToString
            RogerMoorePaymentLabel.ForeColor = Color.Black
        Else
            intRogerHoursWorkedOver = (System.Convert.ToInt16(RogerMooreHoursWorkedMaskedTextBox.Text) - BaseHourlyRate)
            DblRogerTotalPayment = RogerHourlyRate * DblRogerHoursWorked
            DblRogerTotalPaymentOver = intRogerHoursWorkedOver * 1.5 * RogerHourlyRate
            DblRogerTotalPayment = DblRogerTotalPayment + DblRogerTotalPaymentOver
            RogerMoorePaymentLabel.Text = Format(DblRogerTotalPayment, "c").ToString
            RogerMoorePaymentLabel.ForeColor = Color.Green
        End If


        'Pierce's Calculations
        'The "If statement"  determines if the Pierce worked 40 hours or more
        'The code meets the following requirement: If OT is worked, show the pay in green text.
        'Output goes to a label

        If System.Convert.ToInt16(PierceBrosnanHoursWorkedMaskedTextBox.Text) <= 40 Then
            DblPierceTotalPayment = PierceHourlyRate * DblPierceHoursWorked
            PierceBrosnanPaymentLabel.Text = Format(DblPierceTotalPayment, "c").ToString
            PierceBrosnanPaymentLabel.ForeColor = Color.Black
        Else
            intPierceHoursWorkedOver = (System.Convert.ToInt16(PierceBrosnanHoursWorkedMaskedTextBox.Text) - BaseHourlyRate)
            DblPierceTotalPayment = PierceHourlyRate * DblPierceHoursWorked
            DblPierceTotalPaymentOver = intPierceHoursWorkedOver * 1.5 * PierceHourlyRate
            DblPierceTotalPayment = DblPierceTotalPayment + DblPierceTotalPaymentOver
            PierceBrosnanPaymentLabel.Text = Format(DblPierceTotalPayment, "c").ToString
            PierceBrosnanPaymentLabel.ForeColor = Color.Green
        End If

        'Daniel's Calculations
        'The "If statement"  determines if the Daniel worked 40 hours or more
        'The code meets the following requirement: If OT is worked, show the pay in green text.
        'Output goes to a label

        If System.Convert.ToInt16(DanielCraigHoursWorkedMaskedTextBox.Text) <= 40 Then
            DblDanielTotalPayment = DanielHourlyRate * DblDanielHoursWorked
            DanielCraigPaymentLabel.Text = Format(DblDanielTotalPayment, "c").ToString
            DanielCraigPaymentLabel.ForeColor = Color.Black
        Else
            intDanielHoursWorkedOver = (System.Convert.ToInt16(PierceBrosnanHoursWorkedMaskedTextBox.Text) - BaseHourlyRate)
            DblDanielTotalPayment = DanielHourlyRate * DblDanielHoursWorked
            DblDanielTotalPaymentOver = intDanielHoursWorkedOver * 1.5 * DanielHourlyRate
            DblDanielTotalPayment = DblDanielTotalPayment + DblDanielTotalPaymentOver
            DanielCraigPaymentLabel.Text = Format(DblDanielTotalPayment, "c").ToString
            DanielCraigPaymentLabel.ForeColor = Color.Green
        End If

    End Sub

    Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click
        ' Clicking the button clears all hours work text boxes

        SeanConneryHoursWorkedMaskedTextBox.Clear()
        GeorgeLazenbyHoursWorkedMaskedTextBox.Clear()
        RogerMooreHoursWorkedMaskedTextBox.Clear()
        TimothyDaltonHoursWorkedMaskedTextBox.Clear()
        PierceBrosnanHoursWorkedMaskedTextBox.Clear()
        DanielCraigHoursWorkedMaskedTextBox.Clear()

        ' Clicking the button clears all payment labels

        SeanConneryPaymentLabel.Text = ""
        GeorgeLazenbyPaymentLabel.Text = ""
        RogerMoorePaymentLabel.Text = ""
        TimothyDaltonPaymentLabel.Text = ""
        PierceBrosnanPaymentLabel.Text = ""
        DanielCraigPaymentLabel.Text = ""



    End Sub

    Private Sub Robin_Williams_P1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim msg As String
        Dim title As String
        Dim style As MsgBoxStyle
        Dim response As MsgBoxResult
        msg = "GUI program determines the pay for several employees."   ' Define message.
        style = MsgBoxStyle.Information
        title = "About the Program"   ' Define title.
        ' Display message.
        response = MsgBox(msg, style, title)
        
    End Sub



    Private Sub HelpToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HelpToolStripMenuItem.Click
        Help1.Show()
    End Sub
End Class

Open in new window

DOCDGAAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CompProbSolvCommented:
What is the question here?
0
DOCDGAAuthor Commented:
I actually figured it out.
I need to find out how to make sure positive numbers go into my masked textbox.
I would like to set a default value of "0" textboxes if no input.
0
TommySzalapskiCommented:
To have a default, just set the value to 0 (SeanConneryHoursWorkedMaskedTextBox..Text = "0") before you show it to the user. Then if the user does nothing, it's 0.
To force it to be >0, just do a check when the button is pushed, and if anything is <0 display the dialog box again.
You also could use the TextChanged event and delete any '-' that gets typed, but I think that would go beyond the scope of the assignment.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

DOCDGAAuthor Commented:
Hey I'm cool with this.
Thanks for the help.

Now I just need my single digit numbers to align to right side of the text box.

0
DOCDGAAuthor Commented:
I should have clarified. When I input a single digit number it has a blank space. It looks kind of funky, but everything works. I would for numbers to align correctly if possible.
0
TommySzalapskiCommented:
You just need to set the alignment. Something like
textBox1.TextAlign = HorizontalAlignment.Right
0
DOCDGAAuthor Commented:
This was already set through properties menu.
Input looks like this 3_
I would like to be like this at least _3
0
TommySzalapskiCommented:
I'm not sure why it would do that. I think I need more detail. Do you set the formatting anywhere? You didn't set the RightToLeft property to true did you? If none of that fixes it, post some screen shots or something.
0
DOCDGAAuthor Commented:
No, I set a custom mask of "00"
The textalign is set right
0
TommySzalapskiCommented:
Ah, I see. If you set the prompt character to a space instead of an underscore, then I think it will look the way you want.
0
TommySzalapskiCommented:
I tried setting it to the null character, but apparently that's not allowed.
0
DOCDGAAuthor Commented:
I got it!!! Just had to remove my custom masked.
I think I should be able to code the maximum length of text into the textbox.
0
DOCDGAAuthor Commented:
Could find out how to maximum length of text into textbox.
But appreciate your help.
0
TommySzalapskiCommented:
If you use the mask '99' (9s allow for blanks, 0s require all digits) and set the prompt char to a space, it will limit the text to 2 digits and not have the _ characters. I forgot about the 0 making the digit required.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DOCDGAAuthor Commented:
Thanks for helping.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Theory

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.