Write an algorithm that calculates the net pay of an employee based on the formula as shown in Equation (1). Based on the algorithm, draw the flowchart as well. The taxes are calculated as following;
• If GrossPay is less than 5000, then taxes are zero
• If GrossPay is at least 5000, but less than 10,000 then taxes are 2% of the GrossPay
• If GrossPay is 10,000 or more, then taxes are 4% of the GrossPay
NetP ay = GrossP ay − T axes
input:
g \\ GrossPay
t \\ Taxes
n \\ NetPay
case (g < 5000): t = 0
case (5000 <= g < 10000): t = 0.2*g
case (g => 10000): t = 0.4*g
output:
n = g - t
Comments
Leave a comment