zoukankan      html  css  js  c++  java
  • 程序12

     【程序12】

    程序12 题目:企业发放的奖金根据利润提成。利润(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,求应发放奖金总数? 1.程序分析:请利用数轴来分界,定位。注意定义时需把奖金定义成长整型。

     1         var reward = 0;
     2         function sumReward(profit) {
     3             if (profit > 1000000) {  
     4                 reward = (profit - 1000000) * 0.01;
     5             }
     6             if (profit > 600000) {
     7                 if (profit > 1000000) {
     8                     profit = 1000000;
     9                 }
    10                 reward = reward + (profit - 600000) * 0.015;
    11             }
    12             if (profit > 400000) {
    13                 if (profit > 600000) {
    14                     profit = 600000;
    15                 }
    16                 reward = reward + (profit - 400000) * 0.03;
    17             }
    18             if (profit > 200000) { 
    19                 if (profit > 400000) {
    20                     profit = 400000;
    21                 }
    22                 reward = reward + (profit - 200000) * 0.05;
    23             }
    24             if (profit > 100000) {
    25                 if (profit > 200000) {
    26                     profit = 200000;
    27                 }
    28                 reward = reward + (profit - 100000) * 0.075;
    29             }
    30             if (profit > 0) {
    31                 if (profit > 100000) {
    32                     profit = 100000;
    33                 }
    34                 reward = reward + profit * 0.1;
    35             }
    36             return reward;
    37         }
  • 相关阅读:
    文件夹隐藏加密
    hive日期函数
    MySql创建、查看、删除索引
    Vulnhub实战靶场:DC-3
    Vulnhub实战靶场:DC-2
    Vulnhub实战靶场:DC-1
    Vulnhub靶场练习:CHERRY: 1
    Vulnhub靶场练习:Chili:1
    Vulnhub靶场练习:Breach 3.0
    Vulnhub实战靶场练习:Breach 2.0
  • 原文地址:https://www.cnblogs.com/kuikui/p/2560372.html
Copyright © 2011-2022 走看看