zoukankan      html  css  js  c++  java
  • 1、求销售奖金(数轴)

      企业发放的奖金根据利润提成。利润(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 get_bonus(profit):
        print("start...")
        # sum = 0
        # if 0 < profit <= 100000:
        #     sum = profit * 0.1
        # elif 100000 < profit <= 200000:
        #     sum = 100000*0.1 + (profit-100000)*0.075
        # elif 200000 < profit <=400000:
        #     sum = 100000*0.1 + 100000*0.075 + (profit-200000)*0.05
        # elif 400000 < profit <=600000:
        #     sum = 100000*0.1 + 100000*0.075 + 200000*0.05 +(profit-400000)*0.03
        # elif 600000 < profit <=1000000:
        #     sum = 100000*0.1 + 100000*0.075 + 200000*0.05 +(profit-400000)*0.03
        # elif 10000000 < profit:
        #     sum = 100000*0.1 + 100000*0.075 + 200000*0.05 +(profit-400000)*0.03
    
        arr = [1000000, 600000, 400000, 200000, 100000, 0]
        rat = [0.01, 0.015, 0.03, 0.05, 0.075, 0.1]
        r = 0
        for idx in range(0, 6):
            if profit > arr[idx]:
                r += (profit - arr[idx]) * rat[idx]
                profit = arr[idx]
        print('奖金总数是:%d' % r)
    
    
    # l = int(input("输入利润:"))
    get_bonus(11200000)
    

      

  • 相关阅读:
    error: device not found
    xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Deve
    联想X系列服务器
    华为服务器
    linux db2升级
    aix6.1升级openssh&&openssl
    upgrading mysql: error: 1102: Incorrect database name
    linux7配置yum网络源
    How to install fixpack on DB2
    mysql 表空间管理
  • 原文地址:https://www.cnblogs.com/yahutiaotiao/p/12749673.html
Copyright © 2011-2022 走看看