个人所得税,学生成绩的代码

import java.util.Scanner;
class Demo{
    public static void main(String [] args){
        Scanner s=new  Scanner(System.in);
        System.out.println("请输入收入金额");
        double income=s.nextInt();
        double money;
        double tex=0;
        if (income<=3500)
        {
            money=income;
        }
        else if((income-3500)<=500)
        {
            tex =(income-3500)*0.05;
        }
        else if((income-3500)<=2000)
        {
            tex =(income-3500-500)*0.1+25;
        }
        else if((income-3500)<=5000)
        {
            tex =(income-3500-2000)*0.15+125;
        }
        else if((income-3500)<=20000)
        {
            tex =(income-3500-5000)*0.2+375;
        }
        else if((income-3500)<=40000)
        {
            tex =(income-20000-3500)*0.25+1375;
        }
        else if((income-3500)<=60000)
        {
            tex =(income-3500-40000)*0.3+3375;
        }
        else if((income-3500)<=80000)
        {
            tex =(income-3500-60000)*0.35+6375;
        }
        else if((income-3500)<=100000)
        {
            tex =(income-3500-80000)*0.4+10375;
        }
        else if((income-3500)>100000)
        {
            tex =(income-3500-100000)*0.45+15375;
        }
        money=income-tex;
        System.out.println("最后得到的工资为:"+money+"个人应缴纳的税为:"+tex);
    }
}

学生成绩

import java.util.Scanner;
class Demo
{
    public static void main(String[] args){
        Scanner s=new Scanner(System.in);
        System.out.println("请输入一个学生的成绩");
        int score=s.nextInt();
        if(90<=score&&score<=100)
        {
            System.out.println("优秀");
        }
        else if(70<=score&&score<=80)
        {
            System.out.println("良好");
        }
        else if(60<=score&&score<=70)
        {
            System.out.println("及格");
        }
        else if(score<=60&&score>=0)
        {
            System.out.println("不及格");
        }
        else{
            System.out.println("输入错误");
            }
    }

原文地址:https://www.cnblogs.com/wanghuaying/p/9296620.html