Computer Science, asked by answerings, 8 months ago

Write a program in python to accept monthly salary from the user, find and display the income tax according to given chart.

Monthly salary IncomeTax

30000 or more 40% of (monthly salary x12)

20000 to 29999 30% of (monthly salary x12)

15000 to 19999 20% of (monthly salary x 12)

Below 15000 Nil

-​

Answers

Answered by kunduhriddhiraj
1

Answer:

#Assum the taxpayer have to pay each level of tax. the finial tax would be an accumulation of all charge from each level

class tax(object):

   def __init__(self, income):

       self.level= int(income/10000)+1

       self.income= income

       print('the taxer level is: ', self.level)

   def end_level_tax(self):

       #fine the money that have to pay in the last level

       if self.level ==1:

           end_tax=self.income*0.3

       elif self.level ==2:

           end_tax= (self.income-10000)*0.2

       else:

           end_tax=(self.income-(self.level-1)*10000)*0.1

       return end_tax

   def inter_level_tax(self):

       #find the money that has to pay before the last level

       #if level is 1 then there is no inter level.

       if self.level ==1:

           inter_tax =0

       elif self.level ==2:

           inter_tax = 10000*0.3

       else:

           inter_tax = 10000*0.3 + 10000*0.2 + (10000*0.1)* (self.level-3) # subtrct the first, second and end of level

       print('inter_tax',inter_tax)

       return inter_tax

   def total_tax(self):

       return self.inter_level_tax()+self.end_level_tax()

payer=tax(3000)

print(payer.total_tax())

Steve on 26-Jul-2018  

0

I got same question but as first timer, messed it up completely. But later on figured out solution but it was too late.

level = [

   [10000,0.1],

   [20000,0.2],

   [10000,0.1],

   [None, 0.4]

]

def calculate_tax(level, income):

   if income level[0]:

       income = income - level[0]

       return (income, level[0] * level[1])

   else:

       taxable_income = income

       income = 0

       return (income, taxable_income * level[1])

def calculate(level, income):

   total_tax = 0.0

   for l in level:

       income, tax = calculate_tax(l, income)

       total_tax += tax

   return total_tax

print(calculate(level, 71000))

FRIEND HOPE THIS PROGRAM WOULD HELP U

Explanation:

Answered by sanjit2415200
0

Answer:

answer please

Explanation:

writewrite a program in Python to accept monthly salary from a user find and display the income tax according to given chat chat given chart is is monthly salary 30000 are more salary in 100 income tax 40%

Similar questions