既要追求利益,又要面對不可預知的金融投資風險, “不能把雞蛋放在同一個籃子裡”,是以有必要進行組合投資。
通過上述計算與對比,可以幫助客戶進行投資決策。
客戶:那麼能否幫我記錄下一筆一筆不同類型的投資,并動态顯示資金現值呢?
二、需求分析
首先讓客戶選擇所要投入的資金數量(需投入幾筆資金)
然後選擇每筆資金的投資類型(單利/複利)
輸出每一筆資金的終值
三、估計實作所需時間
估計時間:4h
完成過程:
(1)4月5日下午:1h左右
(2)4月5日下午:2h左右
(3)4月6日早上:1h左右
四、兩個結對的同學隻需要一個同學将代碼送出到部落格
(1)結對同伴的學号姓名以及同伴的部落格位址。
周詩琦+201406114108+http://www.cnblogs.com/sr1zsq/p/5344383.html
(2)這個結對程式設計過程中,你做了什麼,同伴做了什麼?
在本次結對程式設計過程中,我們共同對題目要求做了需求分析。
我:1、在一旁輔助周詩琦,審閱代碼
2、提出問題
周詩琦:1、增加功能
2、編寫代碼
(3)總結這次結對程式設計的收獲到和感悟。
在這次結對程式設計中,我深刻地感覺到兩個人合作程式設計和個人單獨工作的不同。每個人的思路都不同,會考慮到不同方面的細節問題。查錯也快了許多,同伴會看到自己看不到的錯。
(4)附上結對工作時的照片。

1 public class fuli3 {
2 static double a=0;
3 static double b=0;
4 static double c=0;
5 public static void main(String[] args) {
6 // TODO 自動生成的方法存根
7
8
9 System.out.println("請選擇1.查詢/2.投資:");
10 Scanner in=new Scanner(System.in);
11 int g = in.nextInt();
12 if(g==1)
13 chaxun();
14 else
15 touzi();
16
17 }
18 private static void touzi() {
19 // TODO 自動生成的方法存根
20 Scanner in=new Scanner(System.in);
21 System.out.println("請輸入投資數量:");
22 int n = in.nextInt();
23 for(int i=1;i<=n;i++){
24 System.out.println("第"+i+"筆資金:");
25 System.out.println("請選擇1.複利/2.單利:");
26 int m = in.nextInt();
27 if(m==1)
28 Fuli.shouru(a,b,c);
29 else
30 Count.danlijisuan(a, b, c);
31 }
32 Scanner in1=new Scanner(System.in);
33 System.out.println("請選擇1.複利/2.單利:");
34 }
35
36
37 private static void chaxun() {
38 // TODO 自動生成的方法存根
39 Scanner in=new Scanner(System.in);
40 System.out.println("請輸入投資數量:");
41 int n = in.nextInt();
42 for(int i=1;i<=n;i++){
43 System.out.println("第"+i+"筆資金:");
44 System.out.println("請選擇1.複利/2.單利:");
45 int m = in.nextInt();
46 if(m==1)
47 Count.fulijisuan(a, b, c);
48 Count.danlijisuan(a, b, c);
49 }
50 Scanner in1=new Scanner(System.in);
51 System.out.println("請選擇1.複利/2.單利:");
52 }
53
54
55 }

1 public class fuli3 {
2 static double a=0;
3 static double b=0;
4 static double c=0;
5 public static void main(String[] args) {
6 // TODO 自動生成的方法存根
7
8
9 System.out.println("請選擇1.查詢/2.投資:");
10 Scanner in=new Scanner(System.in);
11 int g = in.nextInt();
12 if(g==1)
13 chaxun();
14 else
15 touzi();
16
17 }
18 private static void touzi() {
19 // TODO 自動生成的方法存根
20 Scanner in=new Scanner(System.in);
21 System.out.println("請輸入投資數量:");
22 int n = in.nextInt();
23 for(int i=1;i<=n;i++){
24 System.out.println("第"+i+"筆資金:");
25 System.out.println("請選擇1.複利/2.單利:");
26 int m = in.nextInt();
27 if(m==1)
28 Fuli.shouru(a,b,c);
29 else
30 Count.danlijisuan(a, b, c);
31 }
32 Scanner in1=new Scanner(System.in);
33 System.out.println("請選擇1.複利/2.單利:");
34 }
35
36
37 private static void chaxun() {
38 // TODO 自動生成的方法存根
39 Scanner in=new Scanner(System.in);
40 System.out.println("請輸入投資數量:");
41 int n = in.nextInt();
42 for(int i=1;i<=n;i++){
43 System.out.println("第"+i+"筆資金:");
44 System.out.println("請選擇1.複利/2.單利:");
45 int m = in.nextInt();
46 if(m==1)
47 Count.fulijisuan(a, b, c);
48 Count.danlijisuan(a, b, c);
49 }
50 Scanner in1=new Scanner(System.in);
51 System.out.println("請選擇1.複利/2.單利:");
52 }
53
54
55 }