Construct and implement Sub procedure and Function procedure for the following
problems:
1. Computation of the gross salary, tax deductions, total deductions and net salary of the
employee based on the following specifications. If employee is the manager, his or her
salary is 45,000. If the employee is regular or permanent his/her salary is 25,000 and
if the employee is contract of service, his/her salary is 15,000. If the employee’s gross
salary is 20,000 and above, then his /her gross salary is taxable to 2%. Otherwise, no
tax is deducted. Assume the monthly deductions for Philhealth=500.00, SSS=1000.00,
Pag-Ibig=1000.00 and monthly contribution=500.00. To compute for the total
deductions, add Philhealth, SSS, Pag-ibig, monthly contribution and the tax
deduction. To get the net salary, gross salary minus total deductions.
2. Determine the minimum and maximum numbers of 3 numbers.
Imports System.IO
Module Module1
Sub displayNetSalary(ByVal employeeType As Integer)
Dim grossSalary As Double
Dim taxDeductions As Double = 0
Dim totalDeductions As Double
Dim netSalary As Double
Const Philhealth = 500.0
Const SSS = 1000.0
Const PagIbig = 1000.0
Const monthlyContribution = 500.0
'If employee is the manager, his or her salary is 45,000.
If employeeType = 1 Then
grossSalary = 45000
End If
'If the employee is regular or permanent his/her salary is 25,000
If employeeType = 2 Then
grossSalary = 25000
End If
'If the employee is contract of service, his/her salary is 15,000.
If employeeType = 3 Then
grossSalary = 15000
End If
'If the employee’s gross salary is 20,000 and above, then his /her gross salary is taxable to 2%.
'Otherwise, no tax is deducted
If (grossSalary > 20000) Then
taxDeductions = grossSalary * 0.02
End If
'To compute for the total deductions, add Philhealth, SSS, Pag-ibig, monthly contribution and the tax deduction.
totalDeductions = Philhealth + SSS + PagIbig + monthlyContribution + taxDeductions
'To get the net salary, gross salary minus total deductions
netSalary = grossSalary - totalDeductions
Console.WriteLine("The net salary: {0}", netSalary)
End Sub
Sub Main()
Console.WriteLine("1. Employee is the manager")
Console.WriteLine("2. Employee is regular or permanent")
Console.WriteLine("3. Employee is contract of service")
Console.Write("Select employee: ")
Dim employeeType As Integer = Integer.Parse(Console.ReadLine())
displayNetSalary(employeeType)
Console.ReadLine()
End Sub
End Module
Imports System.IO
Module Module1
Function getMinimum(ByVal X As Integer, ByVal Y As Integer, ByVal Z As Integer)
Dim minimum As Integer = If((X < Y AndAlso X < Z), X, If((Y < X AndAlso Y < Z), Y, Z))
Return minimum
End Function
Function getMaximum(ByVal X As Integer, ByVal Y As Integer, ByVal Z As Integer)
Dim maximum As Integer = If((X > Y AndAlso X > Z), X, If((Y > X AndAlso Y > Z), Y, Z))
Return maximum
End Function
Sub Main()
Dim X As Integer = 0
Dim Y As Integer = 0
Dim Z As Integer = 0
Console.Write("Enter the number 1: ")
X = Integer.Parse(Console.ReadLine())
Console.Write("Enter the number 2: ")
Y = Integer.Parse(Console.ReadLine())
Console.Write("Enter the number 3: ")
Z = Integer.Parse(Console.ReadLine())
Console.WriteLine("Minimum number amongs three is: {0}", getMinimum(X, Y, Z))
Console.WriteLine("Maximum number amongs three is: {0}", getMaximum(X, Y, Z))
Console.ReadLine()
End Sub
End Module
Comments
Leave a comment