0414 结对--软件再升级(韩麒麟 列志华)

复利计算再升级------------------------------------------------------------

客户在大家的引导下,有了更多的想法:

  1. 这个数据我经常会填.....帮我预先填上呗?......
  2. 把界面做得简单漂亮好操作一点呗?
  3. 能不能帮我转成个APP,我装到手机上就更方便了?
  4. 我觉得这个很有用,很多人可能都需要这些功能,做到我的微信公众号上吧?
  5. 能不能不要让我填表单,让我发条消息,或者对着手机说句话就可以了?

每组选一两个方向加以改进,让我们的投资计算与记录工具,达到可以发布给用户使用的版本,并发布博客对此次更新进行说明与总结。

•需求是演化出来的:需求的提出,不像我们上学期做编译原理实验一样,一次性地给出完整并且不变的问题描述,现实世界的很多软件需求大都是逐步提出的,因为客户一开始也不确定自己要什么。
•需求的表达:客户不是计算机专业人员,描述需求的方式是自己的业务场景,不会告诉你具体算法。
•业务领域:我们需要去了解我们不懂的领域知识、应用场景。
•软件设计-可扩展性:客户需求不断变化与增加,我们做软件设计时有没有考虑到程序的可扩展性?
•重构:在满足客户越来越多需求的时候,我们会不会发现原来的设计不够好,需要推翻前面所做的工作而对整个架构进行重新设计呢?
•迭代开发:开发-发布-运行-迭加开发-发布-运行……螺旋前进
•版本管理:github使用有什么感受?
•用户体验:界面设计,真实的软件,实现功能只是一方面……
•与人合作
•软件测试与质量保证

二.单元测试预期结果及其代码。

 新增:

  添加了可以修改用户输入数据后可以选择输入的单位,这可以使用户输入时不用输入过多的零,提高了用户的输入的正确率。方便了用户的使用。

有就是,健壮了用户输入数据后,传入到数据库的信息健全性,不会丢失用户的输入数据。之前的版本会使用户的一部分信息丢失,现在已经修复了。

测试模块

测试输入

预期结果

运行结果

bug跟踪

复利计算

(本金,年限,利率,次数)

终值

   

测试运算结果

(100.0,1,0.05,1)

105.0

 

 测试输出正数

(100.0,1,0.05,1)

True

 测试输入负数

 (-100.0,1,-0.05,1)  true  √  已经添加输入控制

单利计算

(利率,本金,年限)

 终值    
 测试运算结果  ("0.05","100.0","1")  105.0   √  
 测试输入负数  ("0.05","100.0","1")  True   √  
测试输出正数 ("-0.05","-100.0","1") true  √   已经添加输入控制
投资年限 (利率,本金,终值,次数)      
测试运算结果 ("0.05","100.0","105.0","1") 1  
测试输出正数 ("0.05","100.0","105.0","1") True  
测试输入负数 ("-0.05","-100.0","105.0","1") true   已经添加输入控制
...... 以下结果与上表一致    

接入数据库主要代码,更改后使输入数据库的信息更全:

复制代码
  1         public MySQL() throws Exception {
  2     
  3             
  4             //STEP 2: Register JDBC driver
  5             Class.forName(JDBC_DRIVER);      //添加MYSQL驱动
  6 
  7             //STEP 3: Open a connection  链接本地MYSQL
  8             conn = (Connection) DriverManager.getConnection(DB_URL,USER,PASS);    
  9            
 10             //STEP 4: Execute a query
 11             stmt = conn.createStatement();
 12             String sql;
 13             sql = "SELECT * FROM test";
 14             ResultSet rs = stmt.executeQuery(sql);
 15 
 16             //STEP 5: Extract data from result set
 17             while(null != rs && rs.next()){
 18                 System.out.println(rs.getString("rate"));
 19                 System.out.println(rs.getString("time"));
 20                 System.out.println(rs.getString("principal"));
 21             }
 22            
 23         }
 24         
 25         
 26         public void sqlInsertSingle(String f,int moneyUnit, String strRate, String strPrincipal,
 27                 String strTime) throws SQLException {
 28             
 29             items[N] = "item_" + String.valueOf(N);
 30             String sql1 = "insert into test(earnings,rate,time,principal)values('" + f + "','"
 31             + strRate + "','" + strTime + "','" + strPrincipal + "')" ; 
 32             stmt.executeUpdate(sql1);
 33             
 34         }
 35         
 36         public void sqlInsertCompound(String strEarnings,int moneyUnit, String strRate, String strPrincipal,
 37             String strTime, String strCount) throws SQLException {
 38             
 39             items[N] = "item_" + String.valueOf(N);
 40             String sql1 = "insert into test(earnings,rate,time,count,principal)values('" + strEarnings + "','" +
 41                     strRate  + "','" + strTime + "','"  + strCount + "','"  + strPrincipal + "')" ;    
 42             stmt.executeUpdate(sql1);
 43         }
 44         
 45         public void sqlInsertTime(String strTime ,int moneyUnit, String strRate, String strPrincipal,
 46             String strEarnings, String strCount) throws SQLException {
 47             
 48                items[N] = "item_" + String.valueOf(N);
 49                String sql1 = "insert into test(time,rate,count,principal,earnings)values('" + strTime + "','"  +
 50                        strRate + "','"  + strCount + "','"  + strPrincipal + "','"  + strEarnings + "')" ;    
 51            stmt.executeUpdate(sql1);
 52         }
 53         
 54         public void sqlInsertPerincome (String strIncome, int moneyUnit, String strRate, String strInvestment,
 55                 String strTime) throws SQLException {
 56             
 57             items[N] = "item_" + String.valueOf(N);
 58                String sql1 = "insert into test(earnings,rate,time,inv)values('" + strIncome + "','"  +
 59                        strRate + "','"  + strTime + "','"  + strInvestment + "')" ;
 60            stmt.executeUpdate(sql1);
 61         }
 62         
 63         public void sqlInsertPrincipal(String strPrincipal, int moneyUnit, String strRate, String strEarnings,
 64                 String strTime, String strCount) throws SQLException{
 65             
 66             items[N] = "item_" + String.valueOf(N);
 67                String sql1 = "insert into test(principal,rate,time,count,earnings)values('"+ strPrincipal + "','"  +
 68                        strRate + "','"  + strTime + "','"  + strCount + "','"   + strEarnings + "')" ;
 69            stmt.executeUpdate(sql1);
 70             
 71         }
 72         
 73         public void sqlInsertRefund (String strRefund, int moneyUnit, String strRate, String strLoan,
 74                 String strTime) throws SQLException {
 75             
 76             items[N] = "item_" + String.valueOf(N);
 77                String sql1 = "insert into test(inv,rate,time,loan)values('" + strRefund + "','"  +
 78                        strRate + "','"  + strTime + "','"  + strLoan +"')" ;
 79            stmt.executeUpdate(sql1);
 80         }
 81         
 82         public void sqlInsertBestProject (String strRate, int moneyUnit , String strEarnings,
 83                 String strPrincipal, String strTime, String strCount) throws SQLException {
 84             
 85             items[N] = "item_" + String.valueOf(N);
 86                String sql1 = "insert into test(rate,time,count,principal,earnings)values('" + strRate + "','"  +
 87                strTime + "','"  + strCount + "','"  + strPrincipal + "','"  + strEarnings + "')" ;
 88            stmt.executeUpdate(sql1);
 89         }
 90         
 91         public ResultSet selectSQL () {
 92             ResultSet rs = null;
 93             try{
 94                 stmt = conn.createStatement();
 95                 String sql;
 96                 sql = "SELECT * FROM test";
 97                 rs = stmt.executeQuery(sql);
 98             }catch (Exception e){
 99                 e.printStackTrace();
100             }
101             
102             return rs;
103             
104         }
105         
复制代码

三.运行情况

使用程序进行更新的数据库

总结

这次做的时间总的来说是比较赶的,虽然完成了,但有很多地方都没有做到尽善尽美,有些功能以后会陆续实现。总而言之,该次合作有利于学生思想的撞击和智慧火花的迸发,能够强化学生的主体意识。

原文地址:https://www.cnblogs.com/hanqilin/p/5393342.html