duanpanhuo0618 2012-01-21 08:01
浏览 71

所得税计算的编程逻辑

Is any one who can help me to create PHP or mysql Code for our Office employee salary tax table. Here is the base for our tax regulation.

 If salary is >= 0 and <= 150 it will be 0% (Nill),
 If salary is >= 151 and <= 650 it will be 10% - 15.00,
 If salary is >= 651 and <= 1400 it will be 15% - 47.50,
 If salary is >= 1401 and <= 2350 it will be 20% -117.50,
 If salary is >= 2351 and <= 3550 it will be 25% - 235.00,
 If salary is >= 3551 and <= 5000 it will be 30% - 412.5,
 If salary is >= 5001 it will be 35% - 662.50
  • 写回答

4条回答 默认 最新

  • douyi1084 2012-01-21 08:07
    关注

    You should learn basic PHP. The solution is trivial.

    function getTax($salary) {
        $percent = 0;
        $subt = 0;
    
        if ($salary >= 0 && $salary <= 150) {
            $percent = 10;
            $subt = 15;
        } elseif ($salary >= 151 && $salary <= 650) {
            ...
        } ...
    
        // do calculations here, ex:
        $final = $salary * $percent / 100 - $subt;
        return $final;
    }
    

    Edit: Thank you Constantin for the function reminder

    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效