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

    1. class Caculate{  
    2.     private String name;  
    3.     private double money;  
    4.     private double actual;  
    5.     /** 
    6.      * @param username 用户名 
    7.      * @param money 用户税前收入 
    8.      */  
    9.     public Caculate(String username,double money) {  
    10.         this.name=username;  
    11.         this.money=money;  
    12.     }  
    13.       
    14.     public  double HowMany(){  
    15.         //java中switch的case变量只支持int char string,而此处是double,所以不能使用switch  
    16.         double shouru = money;//构造函数中本来已经有this.money了,所以再次使用的使用,用成money即可  
    17.         if(shouru <= 1500){  
    18.             System.out.print("不需要缴纳个人所得税");  
    19.             this.actual=shouru;  
    20.         }else if(1500 < shouru && shouru < 3000){  
    21.             this.actual = shouru*(1 - 0.05);  
    22.         }if(3000 <= shouru){  
    23.             this.actual=shouru-(shouru-3000)*0.1;  
    24.         }  
    25.         System.out.println("实际收入为:"+this.actual);  
    26.           
    27.           
    28.         return this.actual;  
    29.     }  
    30. }  
    31. /** 
    32.  * @author 码农小江 
    33.  * PersonalFax.java 
    34.  * 2012-8-7下午11:28:16 
    35.  */  
    36. public class PersonalFax {  
    37.     public static void main(String args[]){  
    38.         Caculate  shiji = new Caculate("码农小江", 1000.2345);  
    39.         double shou =shiji.HowMany();  
    40.         System.out.printf("%.3f", shou);  
    41.                   
    42.     }  
    43.   
    44. }  
  • 相关阅读:
    MD53D模型
    WPF 关于变换
    WPF 关于圆角的制作
    [转载]MVVM、MVVMLight、MVVMLight Toolkit之我见
    Surface Pro 调整空间大小
    WPF 图片浏览 伪3D效果
    WPF 实现视频循环播放
    WPF MediElement 视频播放
    WPF INotifyPropertyChanged
    Matlab摄像头视频基本处理
  • 原文地址:https://www.cnblogs.com/lzq198754/p/5780666.html
Copyright © 2011-2022 走看看