1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
package 本章总结;
public class A02class {
double Money = 0 ;
public double showA( double money, int choice) {
switch (choice) {
case 1 :
Money = (money + money * 0.0603 ) / 36 ;
break ;
case 2 :
Money = (money + money * 0.0612 ) / 60 ;
break ;
case 3 :
Money = (money + money * 0.0639 ) / 240 ;
break ;
default :
A02 A = new A02();
A.main( null );
break ;
}
System.out.println( "月供为:" +Money);
return Money;
}
} package 本章总结;
import java.util.Scanner;
public class A02 {
public static void main(String[] args) {
// TODO Auto-generated method stub
A02class A02 = new A02class();
Scanner in = new Scanner (System.in);
System.out.print( "请输入贷款金额:" );
double Money=in.nextDouble();
System.out.print( "请选择贷款年限:1.3年(36个月) 2.5年(60个月) 3.20年(240个月):" );
int choice =in.nextInt();
A02.showA(Money, choice);
}
} |
本文转自 Y幕徐 51CTO博客,原文链接:http://blog.51cto.com/765133133/1426624