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()
    	
    	
    	
    
  • 相关阅读:
    java web 开发入门
    程序优质网站
    为什么要放弃ssh框架
    JDK核心源码(2)
    Linux 格式化分区 报错Could not stat --- No such file or directory 和 partprobe 命令
    快照COW
    磁盘检测SMART工具
    python学习-3.一些常用模块用法
    python 学习2:生成器,迭代器,装饰器
    关于对SwfUpload的改造
  • 原文地址:https://www.cnblogs.com/endurance9/p/7967263.html
Copyright © 2011-2022 走看看