admin 管理员组文章数量: 893642
java个人所得税计算器
class Caculate{private String name;private double money;private double actual;/*** @param username 用户名* @param money 用户税前收入*/public Caculate(String username,double money) {this.name=username;this.money=money;}public double HowMany(){//java中switch的case变量只支持int char string,而此处是double,所以不能使用switchdouble shouru = money;//构造函数中本来已经有this.money了,所以再次使用的使用,用成money即可if(shouru <= 1500){System.out.print("不需要缴纳个人所得税");this.actual=shouru;}else if(1500 < shouru && shouru < 3000){this.actual = shouru*(1 - 0.05);}if(3000 <= shouru){this.actual=shouru-(shouru-3000)*0.1;}System.out.println("实际收入为:"+this.actual);return this.actual;}
}
/*** @author 码农小江* PersonalFax.java* 2012-8-7下午11:28:16*/
public class PersonalFax {public static void main(String args[]){Caculate shiji = new Caculate("码农小江", 1000.2345);double shou =shiji.HowMany();System.out.printf("%.3f", shou);}}
本文标签: java个人所得税计算器
版权声明:本文标题:java个人所得税计算器 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/jishu/1687605710h120298.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论