Write and run a visual payroll program for 10 employee of a company.The gross pay sums the basic pay, housing allowance and professional allowance (where applicable).Workers grade levels range from 1to 16. Housing allowance of workers is 30% of basic pay for workers on levels 8 to 16 and 40% for levels 1-7 workers.Transport allowance is 20% of basic pay for all workers. Hazard allowance is 15% of basic pay for only levels 8-16 workers. The net pay, which is the take home pay is the gross pay tax (10% of gross pay). Designs form through which each workers data can be entered
Module Module1
Sub Main()
For i As Integer = 1 To 10
Console.WriteLine("Enter the information for worker {0}: ", i)
Dim basicPay As Double = 0
While basicPay <= 0
Console.Write("Enter the basic pay: ")
basicPay = Integer.Parse(Console.ReadLine())
End While
Dim workerGradeLevel As Integer = -1
While workerGradeLevel < 1 Or workerGradeLevel > 16
Console.Write("Select the worker grade levels range from 1 to 16: ")
workerGradeLevel = Integer.Parse(Console.ReadLine())
End While
'Housing allowance of workers is 30% of basic pay for workers on levels 8 to 16 and 40% for levels 1-7 workers.
Dim housingAllowance As Double = basicPay * 0.3
If workerGradeLevel >= 1 And workerGradeLevel <= 7 Then
housingAllowance = basicPay * 0.4
End If
'Transport allowance is 20% of basic pay for all workers.
Dim transportAllowance As Double = basicPay * 0.2
' Hazard allowance is 15% of basic pay for only levels 8-16 workers.
Dim professionalAllowance As Double = 0
If workerGradeLevel >= 8 And workerGradeLevel <= 16 Then
professionalAllowance = basicPay * 0.15
End If
Dim grossPay As Double = basicPay + housingAllowance + professionalAllowance + transportAllowance
Dim netPay As Double = grossPay - grossPay * 0.1
Console.WriteLine("The housing allowance of worker = {0}", housingAllowance.ToString("C"))
Console.WriteLine("The transport allowance = {0}", transportAllowance.ToString("C"))
Console.WriteLine("The hazard allowance = {0}", professionalAllowance.ToString("C"))
Console.WriteLine("The gross pay = {0}", grossPay.ToString("C"))
Console.WriteLine("The net pay = {0}", netPay.ToString("C"))
Console.WriteLine()
Next
Console.ReadLine()
End Sub
End Module
Comments
Leave a comment