- public class Demo {
- public static void main(String[] args) {
- while(true){
- Scanner input = new Scanner(System.in);
- double money;
- System.out.println("请您输入存款数目:");
- money = input.nextInt();
- System.out.println("您的本金为:" + money);
- double lixi1 = money * 0.0225 * 1;
- double lixi2 = money * 0.027 * 2;
- double lixi3 = money * 0.0324 * 3;
- double lixi4 = money * 0.036 * 5;
- System.out.println("存取一年后的利息为:" + lixi1);
- System.out.println("存取两年后的利息为:" + lixi2);
- System.out.println("存取三年后的利息为:" + lixi3);
- System.out.println("存取五年后的利息为:" + lixi4);
- }
-
- }
- }
复制代码 这样写会不会太低端,,太冗长了,,有没有更好的办法..
|
|