Public Class Form1 'Tom Weber cs112 I did not post much but I completed the old green lab book,I hope, ' you give that some cosideration. Thanks. Const Asize As Integer = 0 Dim many As Integer = 0 Dim xyz(20) As Integer '(Asize) Dim sr As IO.StreamReader Dim ctr As Integer Dim data(max) As Integer Const max = 20 '#####reasign if array increases Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click '------ Clear all input fields. Me.txtId.Text = "" Me.txtFirst.Text = "" Me.txtLast.Text = "" Me.txtRate.Text = "" Me.txtHours.Text = "" Me.txtCode.Text = "" '---- Also clear output Me.lstCheck.Items.Clear() End Sub '$$$$$$$$$$$$$$$$$$$$$$$$INPUT METHODS$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Sub getinputs(ByRef id As Integer, ByRef first As String, ByRef last As String, _ ByRef code As Integer, ByRef rate As Double, ByRef hours As Double) '$$$$$$$$$$$$$$ Get these inputs from textboxes. last = getLast() first = getFirst() id = getId() code = getcode() rate = getrate() hours = gethours() End Sub '$$$$$$$$$$$$$$$$$$$$$$$$$ PROCESSING METHODS $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Function calcpay(ByVal hours As Double, ByVal rate As Double, ByVal code As Integer) As Double '$$$$$$$$$$$$$$$ calculate the pay$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Dim stpay As Double = hours * rate '$$$$$$ Straight pay Dim otpay As Double = 0.0 '$$$$$$ Overtime pay '$$$$$$$$$$$$$$Let's Check for O/T$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ If (code <= 1) Then '$$$$$$ eligible for O/T? If (hours > 40.0) Then '$$$$$$ work more than 40 otpay = 0.5 * rate * (hours - 40) '$$$ add 1/2 pay for over40 End If End If Return stpay + otpay End Function Function calctax(ByVal base As Double, ByVal depends As Double) As Double '$$$$$$$$$$$$$$$$$$Calculate the tax Dim result As Double result = base * 0.15 '$$$$$$tax atfixed rate for now!!!!! If (result < 0.0) Then '$$$$$$negative? result = 0.0 End If Return result End Function '$$$$$$$$$$$$$$$$$$$$$$$ OUTPUT METHODS $$$$$$$$$$$$$$$$$$$$$ Sub showStub(ByVal id As Integer, _ ByVal ln As String, ByVal fn As String, _ ByVal rate As Double, ByVal hours As Double, _ ByVal pay As Double) '==== Output the paystub. showit3("PAYSTUB:") showit2("Employee ID is ", id) showit2("LastName: ", ln) showit2("FirstName: ", fn) showit2("Hourly rate is ", rate) showit2("Hourworked: ", hours) showit2("Gross pay is ", pay) End Sub Sub showcheck(ByVal fn As String, ByVal ln As String, ByVal pay As Double) 'Display the paycheck showit1("-------------------------------------------------") showit1("Acme payroll Paycheck:") showit1("Pay to the order of......" & fn & " " & ln) showit1("................... The sum of " & FormatCurrency(pay)) End Sub Sub showit1(ByVal s As String) 'Output a string Me.lstCheck.Items.Add(s) End Sub Sub showit2(ByVal s As String, ByVal t As String) 'Output 2 strings Me.lstStub.Items.Add(s & t) End Sub Sub showit3(ByVal s As String) 'Output a string Me.lstStub.Items.Add(s) End Sub Function getLast() As String Dim result As String result = CStr(Me.TxtLast.Text) Return result End Function Function getFirst() As String Dim result As String result = CStr(Me.txtFirst.Text) Return result End Function Function getId() As Integer Dim result As Integer result = CInt(Me.txtId.Text) Return result End Function Function getcode() As Integer Dim result As Integer result = CInt(Me.txtCode.Text) Return result End Function Function getrate() As Double Dim result As Double result = CDbl(Me.txtRate.Text) Return result End Function Function gethours() As Double Dim result As Double result = CDbl(Me.txtHours.Text) Return result End Function Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click Close() End Sub Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click '$$$$$$$$$$$$$$$$$ displays input box for file name Dim prompt, title, name As String prompt = "enter name of payroll file" title = "Name of File" name = InputBox(prompt, title) filename(name) fillFromFile(name) '<><><><><><>had issue bringing in file!!!!!!!!!!!!!!! End Sub Sub filename(ByRef s As String) Dim prompt, title, name As String prompt = "enter name of payroll file" title = "Name of File" name = InputBox(prompt, title) End Sub Sub fillFromFile(ByRef s As String) '####data is a generic array name### should not be in handler Dim sr = IO.File.OpenText(s) 'File name would be in () so call subthen put nam in () Dim dataIn As Integer ctr = 0 While sr.Peek > -1 And ctr < max '######asign max of array dataIn = CInt(sr.ReadLine) ctr += 1 data(ctr) = dataIn End While sr.Close() End Sub Private Sub btnLook_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLook.Click 'take unique key(ID#)and display record in there text boxes End Sub Private Sub btnPay_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPay.Click '$$$$$$$$$$$$$$ Process the payroll for one employee. '$$$$$ 1. Get empl. data & # hrs worked. '$$$$$$ 2. Calculate grosspay, netpay '$$$$$$$ 3. Display paystub & paycheck ' Declare input variables -- employee data Dim id As Integer ' $$ ss last 4- # Dim first, last As String ' $$Employee name Dim code As Integer ' $$O/T code Dim rate As Double ' $$Hourly pay rate Dim hours As Double ' $$# hrs worked ' $$$$$Declare output variables Dim grosspay As Double ' $$Gross pay amount Dim tax As Double ' $$Tax amount Dim netpay As Double ' $$Net pay amount first = 0 last = 0 ' 1. INPUT: id, first, last, rate, hours `+++++ Add depends Call getinputs(id, first, last, code, rate, hours) ' 2. CALCS: calculate gross pay grosspay = calcpay(hours, rate, code) 'deds = calcdeds(grosspay, depends) ' tax = calctax(grosspay) netpay = grosspay - tax ' 3. OUTPUT: Stub & Check Call showStub(id, last, first, rate, hours, netpay) Call showcheck(first, last, netpay) End Sub '$$$$$$$$$$$did not complete tax!!! 'Sub tax() ' if gross < 51 than * 0 ' if gross<198 than(-51 * (0.1)) ' if gross <653 than 14.70+(gross-198*.15) ' If gross<1533 than 82.95+(gross-653*.25) ' if gross<3202 than 302.95+(gross-1533*.28) ' If gross<6916 than770.27+gross-3202*.33 ' If gross>6916 than1995.89+gross-6916*.35 'End Sub '@#$%^&* Tom Weber cs112 End Class