package day1015; import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double sum = 0, jiju = 0; System.out.print("请输入收入:"); double falary = sc.nextDouble(); System.out.print("请输入五险一金费用:"); double wuxian = sc.nextDouble(); jiju = falary - wuxian -3500; if (falary - wuxian <= 0){ System.out.printf("个人所得税为:0元"); } else if (jiju > 0 && jiju <= 1500){ sum = jiju * 0.03; } else if(jiju > 1500 && jiju <= 4500){ sum = jiju* 0.1 - 105; } else if (jiju > 4500 && jiju <= 9000){ sum = jiju * 0.2 - 555; } else if (jiju > 9000 && jiju <= 35000){ sum = jiju * 0.25 - 1005; } else if (jiju > 35000 && jiju <= 55000){ sum = jiju * 0.3 - 2755; } else if (jiju > 55000 && jiju <= 80000){ sum = jiju* 0.35 - 5505; } else if (jiju > 80000 ){ sum = jiju * 0.4 - 13505; } else{ System.out.printf("输入有误"); } System.out.printf("个人所得税为:%.2f元",sum); } }
总结:
在指令框显示:你好**!
package com.lovo; import javax.swing.JOptionPane; public class Hello { public static void main(String[] args) { //在指令框输入名字 String name = JOptionPane.showInputDialog("请输入你的名字"); //在指令框显示:你好name(输入的名字)! JOptionPane.showMessageDialog(null,"你好"+name+"!"); } }
时间: 2024-10-22 21:05:51