来段代码压压惊
import java.util.Scanner;
public class Four{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
System.out.println("请输入要存入的金额");
int a=sc.nextInt();
System.out.println("请输入要存的年限(存期分为一年、两年、三年、五年)");
int b=sc.nextInt();/*
switch(b){
case 1:
double one=a+a*2.25*1;
System.out.println("到期后的本期总和为:"+one+"元");
break;
case 2:
double two=a+a*2.7*2;
System.out.println("到期后的本期总和为:"+two+"元");
break;
case 3:
double three=a+a*3.25*3;
System.out.println("到期后的本期总和为:"+three+"元");
break;
case 5:
double five=a+a*3.6*5;
System.out.println("到期后的本期总和为:"+five+"元");
break;
default:
System.out.println("输入的存取年限不符合要求");
*/
/* if(b==1){
System.out.println("到期后的本期总和为:"+(a+a*2.25*1)+"元");
}else if(b==2){
System.out.println("到期后的本期总和为:"+(a+a*2.7*2)+"元");
}else if(b==3){
System.out.println("到期后的本期总和为:"+(a+a*3.25*3)+"元");
}else if(b==5){
System.out.println("到期后的本期总和为:"+(a+a*3.6*5)+"元");
}else{
System.out.println("输入的存取年限不符合要求");
}
}
} |
|