java中间变量代码 java中文变量名( 二 )


System.out.println("三个数字从大到小顺序为:" + second + "=" + first + "=" + third);
}else if(second - third = 0){
System.out.println("三个数字从大到小顺序为:" + second + "=" + third + "=" + first);
}else{
System.out.println("三个数字从大到小顺序为:" + third + "=" + second + "=" + first);
}
}
/**
* 利率计算
*/
public static double bonus(){
float profit = 0;
double bonus = 0;
Scanner in = new Scanner(System.in);
System.out.println("请输入利润(万元):");
profit = in.nextFloat();
if(profit = 10){
bonus = profit * 0.1;
}else if(profit10profit = 20){
bonus = (profit - 10) * 0.075 + 10 * 0.1;
}else if(profit20profit = 40){
bonus = (profit - 20) * 0.05 + 20 * 0.1;
}else if(profit40profit = 60){
bonus = (profit - 40) * 0.03 + 40 * 0.1;
}else if(profit60profit = 100){
bonus = (profit - 60) * 0.015 + 60 * 0.1;
}else if(profit100){
bonus = (profit - 100) * 0.01 + 100 * 0.1;
}
return bonus;
}
/**
* 判断元辅音字母
*/
public static void variate2(){
Scanner in = new Scanner(System.in);
System.out.println("请输入一个字母:");
char liter = in.next().charAt(0);
boolean vowel = false;
boolean capital = false;
switch (liter){
case 'A' : vowel = capital = true; break;
case 'O' : vowel = capital = true; break;
case 'E' : vowel = capital = true; break;
case 'I' : vowel = capital = true; break;
case 'U' : vowel = capital = true; break;
case 'a' : vowel = true; break;
case 'o' : vowel = true; break;
case 'e' : vowel = true; break;
case 'i' : vowel = true; break;
case 'u' : vowel = true; break;
default : vowel = capital = false;
}
if(vowel || capital){
if(vowelcapital){
System.out.println("输入的是大写元音字母:" + liter);
}else{
System.out.println("输入的是小写元音字母:" + liter);
}
}else{
System.out.println("输入的是辅音字母:" + liter);
}
}
/**
* 简单计算
*/
public static void calculator(){
Scanner in = new Scanner(System.in);
double first = 0;
double second = 0;
double result = 0;
char operator;
System.out.println("请输入第一个数字:");
first = in.nextDouble();
System.out.println("请输入第二个数字:");
second = in.nextDouble();
System.out.println("请输入运算符:");
operator = in.next().charAt(0);
switch(operator){
case '+' : result = first + second; break;
case '-' : result = first - second; break;
case '*' : result = first * second; break;
case '/' : result = first / second; break;
default : result = 0;
}
System.out.println("计算结果为:" + result);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
variate1();
System.out.println("可提成" + bonus() + "万元");
variate2();
calculator();
}
}
关于java中间变量代码和java中文变量名的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

推荐阅读