zoukankan      html  css  js  c++  java
  • 企业发放的奖金根据利润提成

    """
    题目:企业发放的奖金根据利润提成。利润
    (I) : 
    低于或等于 10 万元时,奖金可提
    10% ; 
    高于 10 万元,低于 20 万元时,低于 10 万元的部分按 10% 提成,高于 10
    万元的部分,可提成
    7.5%; 
    20 万到 40 万之间时,高于 20 万元的部分,可提成 5% ; 
    40 万到 60 万之间时,高于 40 万元的部分,可提成 3% ; 
    60 万到 100 万之间时,高于
    60 万元的部分,可提成
    1.5%, 
    高于 100 万元时, 
    超过 100 万元的部分按 1% 提成, 
    从键盘输入当月利润
    I ,求应发放奖金总数?
    """
    
    
    def calculate_bonus(profit):
    	bonus = 0
    	if profit <= 10:
    		bonus = profit * 0.1
    	elif profit <= 20:
    		bonus = (profit - 10) * 0.075 + 10 * 0.1
    	elif profit <= 40:
    		bonus = (profit - 20) * 0.05 + 10 * 0.1 + 10 * 0.075
    	elif profit <= 60:
    		bonus = (profit - 40) * 0.03 + 10 * 0.1 + 10 * 0.075 + 20 * 0.05
    	elif profit <= 100:
    		bonus = (profit - 60) * 0.03 + 10 * 0.1 + 10 * 0.075 + 20 * 0.05 + 20 * 0.03
    	elif profit > 100:
    		bonus = (profit - 100) * 0.01 + 10 * 0.1 + 10 * 0.075 + 20 * 0.05 +20 * 0.03 + 40 * 0.015
    	return bonus
    
    
    def get_info():
    	try:
    		info = input("利润?")
    		profit = int(info)
    		if profit >0:
    			result = calculate_bonus(profit)
    			print("根据利润值{}万元,奖金金额是{}万元".format(profit, result))
    		else:
    			print("profit can not be below 0")
    	except Exception as e:
    		print(e)
    	else:
    		print("finish")
    	finally:
    		print("method get_info executed")
    	
    
    if __name__ == '__main__':
    	get_info()
    	
    	
    	
    
  • 相关阅读:
    网页中控制ActiveX插件高度
    一种C#开发ActiveX的思路
    注销ie中的ActiveX插件
    vs2012安装程序,无法注册ActiveX
    拓展:switch实现
    021,lambda 表达式
    020,函数:内嵌函数与闭包
    019,函数4 变量的作用域
    018,函数2 形参和实参
    017,函数
  • 原文地址:https://www.cnblogs.com/endurance9/p/7967263.html
Copyright © 2011-2022 走看看