天天看點

複利計算--結對1.0

一、項目需求:

既要追求利益,又要面對不可預知的金融投資風險, “不能把雞蛋放在同一個籃子裡”,是以有必要進行組合投資。

通過上述計算與對比,可以幫助客戶進行投資決策。 

客戶:那麼能否幫我記錄下一筆一筆不同類型的投資,并動态顯示資金現值呢?

二、需求分析

     首先讓客戶選擇所要投入的資金數量(需投入幾筆資金)

     然後選擇每筆資金的投資類型(單利/複利)

     輸出每一筆資金的終值

三、估計實作所需時間

估計時間:4h

完成過程:

(1)4月5日下午:1h左右

(2)4月5日下午:2h左右

(3)4月6日早上:1h左右

四、兩個結對的同學隻需要一個同學将代碼送出到部落格

(1)結對同伴的學号姓名以及同伴的部落格位址。

楊曉霞+201406114107+http://www.cnblogs.com/xiaochenxi/

(2)這個結對程式設計過程中,你做了什麼,同伴做了什麼?

在本次結對程式設計過程中,我們共同對題目要求做了需求分析。

(3)總結這次結對程式設計的收獲到和感悟。

      在這次結對程式設計中,我深刻地感覺到兩個人合作程式設計和個人單獨工作的不同。

      在結對程式設計前,首先要對我們将要完成的工作達成一個共識,然後一起羅列要完成的工作結果和商讨這個過程中所要用到的方法。在商讨的過程中實際上就是一個互相學習,取長補短的過程。

      然後在程式設計的過程中,兩人一起做能更好地避免一些細節性錯誤,減少錯誤的産生。

      在此次的程式設計中,可能由于我們雙方的水準限制,還未能完成資料庫的運用,有待改善。

(4)附上結對工作時的照片。

複利計算--結對1.0

五、修改的代碼

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.0
複利計算--結對1.0
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.0