1. Make a VB program to compute the net salary of an employee. The user inputs the basic salary. And the net salary is shown in a label. Compute the net salary according to the following formulas:
· net salary = basic salary - tax
· if basic salary >= 2000, tax = basic salary * 0.04
· if basic salary < 2000, tax = basic salary * 0.02
Module Module1
Sub Main()
'The user inputs the basic salary.
Console.Write("Enter the basic salary: ")
Dim basicSalary As Double = Double.Parse(Console.ReadLine())
'Compute the net salary according to the following formulas:
'net salary = basic salary - tax
'if basic salary >= 2000, tax = basic salary * 0.04
Dim tax As Double = basicSalary * 0.04
'if basic salary < 2000, tax = basic salary * 0.02
If basicSalary < 2000 Then
tax = basicSalary * 0.02
End If
Dim netSalary As Double = basicSalary - tax
'Display the net salary.
Console.WriteLine("The net salary: " + netSalary.ToString("C"))
Console.ReadLine()
End Sub
End Module
Comments
Leave a comment