zoukankan      html  css  js  c++  java
  • PSP数据比较(四则运算)——计应193第6组童白雪

    PSP数据比较(四则运算)——计应193第6组童白雪

    一、四则运算Math 类

    package text;public class Math {

        public int add(int a,int b)//加法   

      {     

    return a+b;   

      }     

    public int substract(int a,int b)//减法

        {   

       return a-b;  

       }    

     public int multiply(int a,int b)//乘法    

     {  

       return a*b;   

      }    

     public double divide(double a,double b)//除法    

     {  

        return a/b;

        }   

      }

    二,进行单元测试

    package text;

    import static org.junit.Assert.*;

    import org.junit.Before;

    import org.junit.Ignore;

    import org.junit.Test;

    public class MathText {  

    private static Math mm=new Math();   

        @Test  

      public void testAdd() {    

    int result= mm.add(2,3);  

                 

    assertEquals(5,result);    }   

     @Test   

     public void testSubstract() {           

    int result= mm.substract(5,4);     

       assertEquals(1,result);

       }      

     @Test    

    public void testMultiply() {          

    int result= mm.multiply(4,5);    

        assertEquals(20,result);    }

        @Test   

     public void testDivide() {          

    int result= (int) mm.divide(100,25);        

    assertEquals(4,result);           }}

    三,总结

    此程序经过代码多次修改,审核之后,完成程序运行。

    PSP阶段

    预估花费时间

    实际花费时间

    计划

    15

    10

    • 明确相关需求和其他因素,估计每个阶段的时间成本

    15

    10

    开发

    89

    85

    • 需求分析

    9

    8

    • 生成设计文档

    8

    10

    • 设计审复(和同事审核设计文档)

    10

    7

    • 代码规范(为目前开发制定合适的规范)

    9

    5

    • 具体设计

    18

    10

    • 具体编码

    25

    25

    • 代码复审

    10

    10

    • 测试

    8

    8

    报告

    10

    5

    • 测试报告

    5

    3

    • 计算工作量

    2

    1

    • 事后总结,并提出过程改进计划

    3

    1

    • 总共花费时间

    122

    108

  • 相关阅读:
    【leetcode】974. Subarray Sums Divisible by K
    【leetcode】976. Largest Perimeter Triangle
    【leetcode】973. K Closest Points to Origin
    listen 70
    科学60秒 (一) :上
    listen 69
    listen 68 Theoretical Physicist Stephen Hawking Dies at 76
    中译英33
    listen 67
    中译英32
  • 原文地址:https://www.cnblogs.com/group6/p/14641184.html
Copyright © 2011-2022 走看看