#!/usr/bin/python

def impotC2017(amount):
    trancheA = 45916
    tauxA = 0.15
    trancheB = 91831
    tauxB = 0.205
    if amount <= trancheA:
        return amount * tauxA
    elif amount <= trancheB:
        return (amount-trancheA)*tauxB + impotC2017(trancheA)

def impotQ2017(amount):
    trancheA = 42390
    tauxA = 0.16
    trancheB = 84780
    tauxB = 0.2
    if amount <= trancheA:
        return amount * tauxA
    elif amount <= trancheB:
        return (amount-trancheA)*tauxB + impotC2017(trancheA)


def rrq2017(amount):
    taux = 0.054    #pour l'employer
    limite = 55300
    if amount < limite:
        return amount * taux
    return limite * taux

def rqap2017(amount):
    limite = 72500
    taux = 0.0548
    if amount < limite:
        return amount * taux
    return limite*taux

if __name__ == '__main__':
    salaire = 60000
    federal = impotC2017(salaire)
    provincial = impotQ2017(salaire)
    rrq = rrq2017(salaire)
    rqap = rqap2017(salaire)

    print "salaire" , salaire
    print "federal" , federal
    print "provincial", provincial
    print "rrq", rrq
    print "rqap", rqap
    
    print "net", salaire - provincial - federal - rrq - rqap

