标签:generate number 参数 bsp 实例 ble java开发 输入 ber
import java.util.Scanner;
public class Calculate {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
System.out.println("请输入一个数字(小于5000):");
int number = input.nextInt();
double sum = 0;
if (number < 500) {
sum = number * 0.05;
System.out.println(sum);
} else if (number > 500 && number <= 2000) {
sum = (number * 0.1) - 25;
System.out.println(sum);
} else if (number > 2000 && number <= 5000) {
sum = (number * 0.15) - 125;
System.out.println(sum);
} else {
System.out.println("请输入正确数字。");
}
}
}
Java开发中经典的小实例-(if(参数){}else{})
标签:generate number 参数 bsp 实例 ble java开发 输入 ber
原文地址:http://www.cnblogs.com/L-zhihua/p/5988204.html