Payslip Computation






An organisation has 96 employees who are divided into 4  grades as per their basic pay in the following way-

       Grade-I:  Basic  : Rs.10,000 p.m or more
                        D.A     : 40% of Basic
                        H.R.A     : 30% of Basic

       Grade-II:  Basic  : Rs.5,000 p.m or more but less than Rs.10,000
                          D.A     : 40% of Basic
                          H.R.A    : 25% of Basic

       Grade-III:  Basic : < Rs.5, 000 but > Rs.2, 000 p.m
                           D.A   : 30% of Basic
                           H.R.A   : 20% of Basic

       Grade-IV:  Basic  : Rs.2,000 p.m or less
                           D.A    : 30% of Basic
                           H.R.A   : 15% of Basic

If the Salary ( ie total of Basic, D.A and H.R.A) is above Rs.50,000 per annum then income tax at a rate of 30% of the annual salary exceeding Rs.50,000 is deducted on monthly basis at source. 
Taking name of the employee and the Basic (monthly) as inputs, a pay slip for each employee is to be generated.

CODING

def grade1(basic):
    da=1
    hra=1
    da=0.4*basic
    hra=0.3*basic
    net=basic+da+hra

    return net

def grade2(basic):
    da=1
    hra=1
    da=0.4*basic
    hra=0.25*basic
    net=basic+da+hra

    return net

def grade3(basic):
    da=1
    hra=1
    da=0.3*basic
    hra=0.20*basic
    net=basic+da+hra

    return net

def grade4(basic):
    da=1
    hra=1
    da=0.3*basic
    hra=0.15*basic
    net=basic+da+hra

    return net

basic=int(input("Monthly salary"))
name=input("Name of employee")

if(basic>10000):
    net=grade1(basic)
if(basic>5000 and basic<=10000):
    net=grade2(basic)
if(basic>2000 and basic<=5000):
    net=grade3(basic)
if(basic<=2000):
    net=grade4(basic)

if(net>50000):
    exceed=net-50000
    tax=0.3*exceed
    tax=tax/12
else:
    tax=0

net=net-tax

print("Basic salary", basic)
print("Net Salary", net)
print("Income Tax", tax)

PAYSLIP

Monthly salary 40000
Name of employee Shinjini Das
Basic salary 40000
Net Salary 67550.0
Income Tax 450.0



Comments