某企业发放的奖金是根据利润提成的。利润低于或等于10万元时,奖金可提12%;利润高于10万元,低于20万元时,高于10万元的部分,可提成8.5%;20万元40万元之间时,高于20万元的部分,可提成6%;40万60万之间时,高于40万元的部分,可提成4%;60 万~100万之间时,高于60万元的部分,可提成2.5%;高于100万元时,超过100万元的部分按1%提成。从键盘输人当月利润,求应发放奖金的总数。
n=float(input())
m=0
if n>1000000:
m+=(n-1000000)*0.01
n=1000000
if n>600000:
m+=(n-600000)*0.025
n=600000
if n>400000:
m+=(n-400000)*0.04
n=400000
if n>200000:
m+=(n-200000)*0.06
n=200000
if n>100000:
m+=(n-100000)*0.085
n=100000
m+=n*0.12
print(m)
x = input("输人当月利润:")
try:
y = float(x)
s = 0
if y <= 100000:
s = y * 0.12
elif y < 200000:
s = 100000 * 0.12 + (y - 100000) * 0.085
elif y < 400000:
s = 100000 * 0.12 + 100000 * 0.085 + (y - 200000) * 0.06
elif y < 600000:
s = 100000 * 0.12 + 100000 * 0.085 + 200000 * 0.06 + (y - 400000) * 0.04
elif y < 1000000:
s = 100000 * 0.12 + 100000 * 0.085 + 200000 * 0.06 + 200000 * 0.04 + (y - 600000) * 0.025
else:
s = 100000 * 0.12 + 100000 * 0.085 + 200000 * 0.06 + 200000 * 0.04 + 200000 * 0.025 + (y - 1000000) * 0.01
print("应发放奖金的总数:",s)
except:
print("输入错误!")
根据输入的月利润计算应发放的奖金的处理思路和代码如下,望采纳。
profit = float(input("输入月度利润: "))
bonus = 0
if profit <= 100000:
bonus = profit * 0.12
elif profit <= 200000:
bonus = 100000 * 0.12 + (profit - 100000) * 0.085
elif profit <= 400000:
bonus = 100000 * 0.12 + 100000 * 0.085 + (profit - 200000) * 0.06
elif profit <= 600000:
bonus = 100000 * 0.12 + 100000 * 0.085 + 200000 * 0.06 + (profit - 400000) * 0.04
elif profit <= 1000000:
bonus = 100000 * 0.12 + 100000 * 0.085 + 200000 * 0.06 + 200000 * 0.04 + (profit - 600000) * 0.025
else:
bonus = 100000 * 0.12 + 100000 * 0.085 + 200000 * 0.06 + 200000 * 0.04 + 400000 * 0.025 + (profit - 1000000) * 0.01
print("奖金:", bonus)
profit=float(input("输入利润/万元:"))
assert profit>0,'输入错误!'
if profit<=10:
print('奖金:{}万'.format(profit*.12))
elif 10<profit<=20:
print('奖金:{}万'.format((profit-10)*.085))
elif 20<profit<=40:
print('奖金:{}万'.format((profit-20)*.06))
elif 40<profit<=60:
print('奖金:{}万'.format((profit-40)*.04))
elif 60<profit<=100:
print('奖金:{}万'.format((profit-60)*.025))
else:
print('奖金:{}万'.format((profit-100)*.01))