zoukankan      html  css  js  c++  java
  • 个人所得税

    <!DOCTYPE html>
    <html>
    <head>
    <title> new document </title>
    <meta charset="utf-8">
    </head>

    <body>
    <script>

    /**
    * 个税计算
    */
    function calPersonalTax(){
    var salary = parseInt(prompt("请输入您本月的工资:",0.0));
    var _salary = salary;//保存原始工资

    var tax = 0; //最终缴纳的税金

    //1、判断 salary 是否 > 9000 , 如果大于9000的话,9000以上部分 缴纳 20% 的税,9000以及下部分,按下个梯度算
    if(salary > 9000){
    //计算 大于 9000部分的税金
    tax = tax + (salary - 9000) * 0.2;
    salary = 9000;
    }
    //2、判断 salary 除9000以外的部分是否大于5000,如果大于的话 缴纳 10% 的税
    if(salary > 5000){
    tax = tax + (salary - 5000) * 0.1;
    salary = 5000;
    }
    //3、判断 salary 是否大于 3500
    if(salary > 3500){
    tax = tax + (salary - 3500) * 0.03;
    }

    console.log("您的工资为:"+_salary + "元,您共需要缴纳的税金为:"+tax+"元,实发工资:"+(_salary - tax)+"元");
    }

    /**
    * 计算 克莱托指数
    */
    function calKlt(){
    var height = parseFloat(prompt("请输入身高(m)",0.0));
    var weight = parseFloat(prompt("请输入体重(kg)",0.0));

    var klt = weight / (height * height);

    console.log("您的克莱托指数为:"+klt);
    if(klt < 20){
    console.log("偏瘦");
    }else if(klt > 25){
    console.log("偏胖");
    }else{
    console.log("恭喜你,正常 !");
    }
    }


    </script>
    <button onclick="calKlt()">计算克莱托</button>
    <button onclick="calPersonalTax()">个税计算器</button>
    </body>
    </html>

  • 相关阅读:
    [数学-构造矩阵]NEFU 1113
    设计模式【1】:原型模式【创建对象】
    XML(五)dom4j增删改查
    小规则让你写出美丽又高效的程序
    jQuery源代码解析(3)—— ready载入、queue队列
    cocos2d-Lua02Lua面向对象
    在Linux下用make指令编译进度条程序。
    JS两日期相减
    java debugger
    tomcat server.xml
  • 原文地址:https://www.cnblogs.com/lijun6/p/10449631.html
Copyright © 2011-2022 走看看