一、项目需求:
既要追求利益,又要面对不可预知的金融投资风险, “不能把鸡蛋放在同一个篮子里”,所以有必要进行组合投资。
通过上述计算与对比,可以帮助客户进行投资决策。
客户:那么能否帮我记录下一笔一笔不同类型的投资,并动态显示资金现值呢?
二、需求分析
首先让客户选择所要投入的资金数量(需投入几笔资金)
然后选择每笔资金的投资类型(单利/复利)
输出每一笔资金的终值
三、估计实现所需时间
估计时间:4h
完成过程:
(1)4月5日下午:1h左右
(2)4月5日下午:2h左右
(3)4月6日早上:1h左右
四、两个结对的同学只需要一个同学将代码提交到博客
(1)结对同伴的学号姓名以及同伴的博客地址。
杨晓霞+201406114107+http://www.cnblogs.com/xiaochenxi/
(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 }