Question

Create payroll using Visual basic language with this Pseudocode VALIDATE data (FuntionDataOk) INPUT employee data(Sub procedure...

Create payroll using Visual basic language with this Pseudocode

VALIDATE data (FuntionDataOk)

INPUT employee data(Sub procedure InputData)

COMPUTE CURRENT GROSSPAY (Funtion Gross_Pay)

COMPUTE TOTAL EARNINGS TO DATE (Function total_Pay)

COMPUTE FICA TAX (Function FICA_Tax)

COMPUTE INCOME TAX WITHHELD (Function fed_tax)

Adjust pay for witholding allowances

if employee is single Then

COMPUTE INCOME TAX WITHHELD (function TaxSingle)

ELSE

COMPUTE INCOME TAX WITHHELD (Function TaxMarried)

END IF

COMPUTE PAYCHECK AMOUNT (Function Net_Check)

DISPLAY PAYROLL INFORMATION (Sub procedure ShowPayroll)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Payroll using Visual basic language with above Pseudocode

Basically this payroll design for weekly but you can extend this and use it according to your need on the given condition.

After the data for an employee has been gathered from the text boxes, the program must compute the five items appearing I and then display the payroll information. The five computations from the basic tasks of the program:

1.   

Compute current earnings.

2.

Compute year-to-date earnings.

3.

Compute FICA tax.

4.

Compute federal income tax withheld.

5.

Compute paycheck amount (that is, take-home pay).

Tasks 1, 2, 3, and 5 are fairly simple. Each involves applying a formula to given data.

Task divided into subpart

divided into the following subtasks:

4.1. Compute pay adjusted by exemptions.

4.2. Compute income tax withheld for single employee.

4.3. Compute income tax withheld for married employee.

Tasks and their procedures.

Task Procedure

0. Input employee data. InputData

1. Compute current earnings. Gross_Pay
  
2. Compute year-to-date earnings. Total_Pay

3. Compute FICA tax. FICA_Tax

4. Compute federal income tax withheld. Fed_Tax

4.1 Compute adjusted pay. Fed_Tax

4.2 Compute amount withheld for single employee. TaxSingle

4.3 Compute amount withheld for married employee. TaxMarried

5. Compute paycheck amount. Net_Check

6. Display payroll information. ShowPayroll

Code -:

Private Sub btnDisplay_Click(...)

Handles btnDisplay.Click

Dim empName As String = "" 'Name of employee   
Dim hrWage As Double 'Hourly wage   
Dim hrsWorked As Double 'Hours worked this week   
Dim exemptions As Integer 'Number of exemptions for employee   
Dim mStatus As String = "" 'Marital status: S - Single; M - Married   
Dim prevPay As Double 'Total pay for year excluding this week Dim pay As Double
'This week's pay before taxes   
Dim totalPay As Double 'Total pay for year including this week   
Dim ficaTax As Double 'FICA taxes for this week   
Dim fedTax As Double 'Federal income tax withheld this week Dim check As Double
'Paycheck this week (take-home pay) 'Obtain data, compute payroll, display results   
'Task 0 InputData(empName, hrWage, hrsWorked, exemptions, _mStatus, prevPay)   
'Task 1 pay = Gross_Pay(hrWage, hrsWorked)   
'Task 2 totalPay = Total_Pay(prevPay, pay)
'Task 3 ficaTax = FICA_Tax(pay, prevPay, totalPay)   
'Task 4 fedTax = Fed_Tax(pay, exemptions, mStatus)
'Task 5 check = Net_Check(pay, ficaTax, fedTax)
'Task 6 ShowPayroll(empName, pay, totalPay, ficaTax, fedTax, check)
End
Sub

Private Sub btnNext_Click(...)
Handles btnNext.Click
'Clear all masked text boxes for next employee's data txtName.Clear()
txtWage.Clear()   
txtHours.Clear()   
txtExempts.Clear()   
mtxtMarital.Clear()   
txtPriorPay.Clear()   
lstResults.Items.Clear()
End
Sub

Private Sub btnQuit_Click(...)
Handles btnQuit.Click   
End
End
Sub
Sub

InputData(ByRef empName As String, ByRef hrWage As Double, _ ByRef hrsWorked As Double, ByRef exemptions As Integer, _ f mStatus As String, ByRef prevPay As Double)

'Task 0: Get payroll data for employee   
empName = txtName.Textd   
hrWage = CDbl(txtWage.Text)   
hrsWorked = CDbl(txtHours.Text)   
exemptions = CInt(txtExempts.Text)   
mStatus = mtxtMarital.Text.ToUpper.Substring(0, 1) 'M or S   
prevPay = CDbl(txtPriorPay.Text)
End
Sub

Function Gross_Pay(ByVal hrWage As Double, ByVal hrsWorked As Double) _ As Double   

'Task 1: Compute weekly pay before taxes   
If hrsWorked <=(time in hours) Then   
Return hrsWorked * hrWage
Else   
Return (time in hours) * hrWage + (hrsWorked - (time in hours)) * (Value) * hrWage   
End
If End Function
Function Total_Pay(ByVal prevPay As Double, _ ByVal pay As Double) As Double   
'Task 2: Compute total pay before taxes   
Return prevPay + pay
End Function
Function FICA_Tax(ByVal pay As Double, ByVal prevPay As Double, _ ByVal totalPay As Double) As Double

'Task 3: Compute social security and medicare tax   
Dim socialSecurity As Double 'Social Security tax for this week   
Dim medicare As Double 'Medicare tax for this week   
Dim sum As Double 'Sum of above two taxes   
If totalPay <= (given amount)
Then socialSecurity = (increament/decreament) * pay   
ElseIf prevPay < (given amount)
Then socialSecurity = (increament/decreament for socialsecurity) * ((given amount) - prevPay)   
End If medicare = (increament/decreamentfor medicare) * pay   
sum = socialSecurity + medicare   
Return Math.Round(sum, 2) 'Round to nearest cent
End Function
Function Fed_Tax(ByVal pay As Double, ByVal exemptions As Integer, _ ByVal mStatus As String) As Double   

'Task 4.1: Compute federal income tax rounded to two decimal places
Dim adjPay As Double   
Dim tax As Double 'Unrounded federal tax   
adjPay = pay - ((given condition value) * exemptions)
If adjPay < 0
Then adjPay = 0   
End If   
If mStatus = "S"
Then tax = TaxSingle(adjPay)
'Task 4.2   
Else tax = TaxMarried(adjPay)   
'Task 4.3   
End If Return Math.Round(tax, 2) 'Round to nearest cent
End Function
Function TaxSingle(ByVal adjPay As Double) As Double   
'Task 4.2: Compute federal tax withheld for single person   
Select Case adjPay   
Case (0 to n1)   
Return 0
Case (n1 to n2)   
Return (given condition(Value)) * (adjPay - (given conditon(Value)))   
Case (n2 to n3)
Return (given condition(Value)) + (given condition(Value)) * (adjPay - (given conditon(Value)))   
Case (n3 to n4)
Return (given condition(Value)) + (given condition(Value)) * (adjPay - (given conditon(Value)))   
Case Is > n4   
Return (given condition(Value)) + (given condition(Value)) * (adjPay - (given conditon(Value)))   
End
Select End Function
Function TaxMarried(ByVal adjPay As Double) As Double   
'Task 4.3: Compute federal tax withheld for married person   
Select
Case adjPay   
Case (0 to n1)   
Return 0
Case (n1 to n2)   
Return (given condition(Value)) * (adjPay - (given conditon(Value)))   
Case (n2 to n3)
Return (given condition(Value)) + (given condition(Value)) * (adjPay - (given conditon(Value)))   
Case (n3 to n4)
Return (given condition(Value)) + (given condition(Value)) * (adjPay - (given conditon(Value)))   
Case Is > n4   
Return (given condition(Value)) + (given condition(Value)) * (adjPay - (given conditon(Value)))   
End
Select End Function
Function Net_Check(ByVal pay As Double, ByVal ficaTax As Double, _ ByVal fedTax As Double) As Double

'Task 5: Compute amount of money given to employee   
Return pay - ficaTax - fedTax End
Function
Sub
ShowPayroll(ByVal empName As String, ByVal pay As Double, _ ByVal totalPay As Double, ByVal ficaTax As Double, _ ByVal fedTax As Double, ByVal check As Double)

'Task 6: Display results of payroll computations   
Dim fmtStr As String = "{0,24} {1,-10:C}"   
With lstResults.Items   
.Clear()   
.Add("Payroll results for " & empName)   
.Add("")   
.Add(String.Format(fmtStr, "Gross pay this period:", pay))   
.Add("")
.Add(String.Format(fmtStr, "Year-to-date earnings:", totalPay)) .Add("")   
.Add(String.Format(fmtStr, "Fica Taxes this period:", ficaTax)) .Add("")   
.Add(String.Format(fmtStr, "Income tax withheld:", fedTax)) .Add("")   
.Add(String.Format(fmtStr, "Net pay (check amount):", check))   
End With End
Sub

OUTPUT

Template for entering payroll data

Add a comment
Know the answer?
Add Answer to:
Create payroll using Visual basic language with this Pseudocode VALIDATE data (FuntionDataOk) INPUT employee data(Sub procedure...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Chapter 8 6 What is the net pay for the employee? week. Payroll data for the...

    Chapter 8 6 What is the net pay for the employee? week. Payroll data for the current week are as follows: hours worked, 46; federal income tax withheld, $300 cumulative earnings for year prior to current week, 590,700; social security tax rate, 6.0% on maximam of ST6,800; and Medicare tax rate, 1.5 % on all carnings. What is the net pay for the employee? a. S1,147.95 An employee receives an hourly rate of S30, with time and a half for...

  • If you’re using Visual Studio Community 2015, as requested, the instructions below should be exact but...

    If you’re using Visual Studio Community 2015, as requested, the instructions below should be exact but minor discrepancies may require you to adjust. If you are attempting this assignment using another version of Visual Studio, you can expect differences in the look, feel, and/or step-by-step instructions below and you’ll have to determine the equivalent actions or operations for your version on your own. INTRODUCTION: In this assignment, you will develop some of the logic for, and then work with, the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT