تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
2830 أدوات العرض

i'm trying to include a tax calculation as a salary rule that will calculate the tax depending on the amount earned. but i get an error. can someone help me identify what is wrong 

a = 235000
b = 335000
c = 410000
d = 10000000
result = 0;
result1 = 0;
result2 = 0;
result3 = 0;
result4 = 0;
result5 = 0;

if (contract.wage < a):
result1 = 0;
if (contract.wage > a and contract.wage <= b):
result2 = 0.1 * (contract.wage -c)
elif (contract.wage > b) :
result2 = (0.1 * ( b - a))
if (contract.wage > b and contract.wage <= c):
result3 = (0.2 * (contract.wage - b))
elif (contract.wage > c ):
result3 = (0.2 * (c -b))
if (contract.wage > c and contract.wage <= d):
result4 = (0.3 * (contract.wage - c))
if (contract.wage > d ):
result5 = (0.4 * (contract.wage - d))
result6 = (0.3 * (d - c))

result = result1 + result2 + result3 + result4 + result5+ result6


الصورة الرمزية
إهمال
الكاتب

thank you for the help. it was great 

Can you please Vote for the answer.
Thanks

أفضل إجابة

Hi

Please try this code.

a = 235000
b = 335000
c = 410000
d = 10000000
result = 0;
result1 = 0;
result2 = 0;
result3 = 0;
result4 = 0;
result5 = 0;
result6 = 0;

if (contract.wage < a):
result1 = 0;

if (contract.wage > a and contract.wage <= b):
result2 = 0.1 * (contract.wage - a)
elif (contract.wage > b) :
result2 = (0.1 * ( b - a))

if (contract.wage > b and contract.wage <= c):
result3 = (0.2 * (contract.wage - b))
elif (contract.wage > c ):
result3 = (0.2 * (c -b))

if (contract.wage > c and contract.wage <= d):
result4 = (0.3 * (contract.wage - c))
elif (contract.wage > d ):
result6 = (0.3 * (d - c))
result5 = (0.4 * (contract.wage - d))

result = result1 + result2 + result3 + result4 + result5+ result6



Hope it will help you.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
مارس 15
3140
1
أغسطس 25
3488
1
أكتوبر 24
1820
2
يوليو 24
2047
0
مايو 23
2231