从工资中计算税款 [英] calculate tax from salary

查看:88
本文介绍了从工资中计算税款的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我想根据薪金计算税金

Hello, I want to calculate tax from salary

public float getVasikosMisthos() {
      return vasikosMisthos;
  }
  public void setVasikosMisthos(float vasikosMisthos) throws  NegativeSalaryException  {
      if(vasikosMisthos<=0){
         throw new  NegativeSalaryException(vasikosMisthos);
      }
          this.vasikosMisthos = vasikosMisthos;
  }


public double taxErgazomenos()
    {
    if(getVasikosMisthos()<=12000) {
        return foros=0.01*getVasikosMisthos();
        }
    else if(getVasikosMisthos()>=12000 && getVasikosMisthos()<=16000)
    {
        return foros = 15 / 100 * getVasikosMisthos();
    }
 else if(getVasikosMisthos>=16000 && getVasikosMisthos()<=18500)
    {
     return foros=20/100*getVasikosMisthos();

 }
 else if(getVasikosMisthos()>=18500 &&getVasikosMisthos()<=24000)
    {
    return foros=28/100*(getVasikosMisthos());
 }
 else if(getVasikosMisthos()>=24000 &&getVasikosMisthos()<=28000)
    {
     return foros=35/100*getVasikosMisthos();
 }
 else if(getVasikosMisthos()>=28000 &&getVasikosMisthos()<=36000)
    {
     foros=40/100*getVasikosMisthos();
 }
    return foros;



直到12000年的税率为10%,依此类推.
为什么在我运行程序时征税为零?



until 12000 tax is 10% and so on.
Why taxes when i run the program is zero?

推荐答案

从所有"if"条件中删除"return"关键字.

Remove the "return" keyword from all the "if" conditions.

public double taxErgazomenos()
    {
    if(getVasikosMisthos()<=12000) {
        foros=0.01*getVasikosMisthos();
        }
    else if(getVasikosMisthos()>=12000 && getVasikosMisthos()<=16000)
    {
        foros = 15 / 100 * getVasikosMisthos();
    }
 else if(getVasikosMisthos>=16000 && getVasikosMisthos()<=18500)
    {
     foros=20/100*getVasikosMisthos();
 }
 else if(getVasikosMisthos()>=18500 &&getVasikosMisthos()<=24000)
    {
    foros=28/100*(getVasikosMisthos());
 }
 else if(getVasikosMisthos()>=24000 &&getVasikosMisthos()<=28000)
    {
     foros=35/100*getVasikosMisthos();
 }
 else if(getVasikosMisthos()>=28000 &&getVasikosMisthos()<=36000)
    {
     foros=40/100*getVasikosMisthos();
 }
    return foros;
}


尝试:
public double taxErgazomenos()
    {
    if(getVasikosMisthos()&lt;=12000) {
        return 0.01*getVasikosMisthos();
        }
    else if(getVasikosMisthos()&gt;=12000 && getVasikosMisthos()&lt;=16000)
    {
        return 15 / 100 * getVasikosMisthos();
    }
 else if(getVasikosMisthos&gt;=16000 && getVasikosMisthos()&lt;=18500)
    {
     return 20/100*getVasikosMisthos();

 }
 else if(getVasikosMisthos()&gt;=18500 &&getVasikosMisthos()&lt;=24000)
    {
    return 28/100*(getVasikosMisthos());
 }
 else if(getVasikosMisthos()&gt;=24000 &&getVasikosMisthos()&lt;=28000)
    {
     return 35/100*getVasikosMisthos();
 }
 else if(getVasikosMisthos()&gt;=28000 &&getVasikosMisthos()&lt;=36000)
    {
     return 40/100*getVasikosMisthos();
 }
else 
   return 50/100*getVasikosMisthos();
}


这篇关于从工资中计算税款的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆