Answer to Question #183979 in Visual Basic for amal Alalem

Question #183979

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


1
Expert's answer
2021-04-22T00:02:51-0400
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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS