I am new to all this VB coding so kindly assist. Here is the question: Given that an employee earns an arbitrary basic salary, write a program to calculate the employees net salary given that the deductions are specified as follows:
NSSA contribution is calculated at 7% of the gross salary
PAYE is calculated as specified in the tax tables below
Aids levy is calculated as 3% of your PAYE
Maximum gross salary is $10000 and minimum is $100
Nett Salary is given by the formulae:
Nett Salary = (Gross Salary - Pension) - (Aids Levy + PAYE)
Tax Tables - PAYE
from 0 to 300.00 multiply by 0% - $6 000 per month
from 300.01 to 1,500.00 multiply by 20% Deduct 60.00
from 1,500.01 to 3,000.00 multiply by 25% Deduct 135.00
from 3,000.01 to 5,000.00 multiply by 30% Deduct 285.00
from 5,000.01 to 10,000.00 multiply by 35% Deduct 535.00
This is what i have so far but its not working
Module Module1
Sub Main()
Dim GrossSalary As Decimal
Dim NSSADed As Decimal
Dim PAYEDed As Decimal
Dim AidsLevyDed As Decimal
Dim NetSalary As Decimal
Dim maxIncome As Decimal
Dim minIncome As Decimal
minIncome = 100
maxIncome = 10000
NSSADed = 0.07 * GrossSalary
AidsLevyDed = 0.03 * PAYEDed
If GrossSalary >= minIncome Then
minIncome = GrossSalary
ElseIf GrossSalary <= maxIncome Then
maxIncome = GrossSalary
Else : Console.WriteLine("Out of Range")
End If
If GrossSalary >= 0 AndAlso GrossSalary <= 300 Then
PAYEDed = (GrossSalary * 0.0) - 0
ElseIf GrossSalary >= 300.01 AndAlso GrossSalary <= 1500 Then
PAYEDed = (GrossSalary * 0.2) - 60
ElseIf GrossSalary >= 1500.01 AndAlso GrossSalary <= 3000 Then
PAYEDed = (GrossSalary * 0.25) - 135
ElseIf GrossSalary >= 3000.01 AndAlso GrossSalary <= 5000 Then
PAYEDed = (GrossSalary * 0.3) - 285
ElseIf GrossSalary >= 5000.01 AndAlso GrossSalary <= 10000 Then
PAYEDed = (GrossSalary * 0.35) - 535
Else : Console.WriteLine("Invalid Input")
End If
Console.Out.Write("Enter Gross Salary: ")
GrossSalary = Console.In.ReadLine()
NetSalary = (GrossSalary - NSSADed) - (AidsLevyDed + PAYEDed)
Console.Out.WriteLine("Your NetPay: " & (FormatCurrency(NetSalary)))
Console.ReadKey()
End Sub
End Module
If i run the program, this is what im getting:
Enter Gross Salary: 5500
Your NetPay: US$5,500.00
which means its not executing any calculation i want it to