博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
软件结对编程作业
阅读量:5840 次
发布时间:2019-06-18

本文共 53479 字,大约阅读时间需要 178 分钟。

 

一、结对信息

1.1 结对编程成员:
蒋勃超:201521123087     

谢季努:201521123079

1.2 项目开发的码云地址:https://gitee.com/jbc1132/jbc1/blob/6c8f278bedba41d70802c3334c0afd08b42eafba/jbc1.java
1.3 选择修改的程序代码:
个人博客地址5: ,源代码:
1.4 码云提交记录:

二、

 

    1. 需求分析:针对现有代码的改进分析,新开发功能的分析。

      现有代码改进分析
      目前就发现了两个bug,一个是功能键“复习”,他会回到主页面再次进行做题,功能键与实际内容不符,所以修改了功能键名称为“继续”。
      另一个是他的正确率的计算有误,第一次运行程序的时候,计算出来的正确率结果是正确的,当点击了“继续”并再次做题之后,他的正确题数rn会累加,导致正确率计算出错,因此,我们在显示正确率之后令“rn=0.0”,避免他的累加。
      图片展示:
      原功能:

    2. 程序设计:针对新开发功能做设计,建议使用思维导图。

      原本打算用二叉树来做随机算术题的产生。但后来观察了源代码,如果要使用二叉树的话要把他们的源代码全部推翻重来,如此一来,将耗费大量的时间与精力,于是后来还是放弃了,选择了一个较为简单,而且契合恶源代码的方法。

    3. 代码如下:
      import java.util.Random;import java.util.Scanner;public class jbc1 {    public static void main(String[] args){        int x,y,z,p,g;        int a,b,c,m,n;        int h = 0;        System.out.printf("请输入需要生成的题目数量:");        Scanner d = new Scanner(System.in);        x = d.nextInt();        for(int i = 0 ; i < x ; i++){            Random aa = new Random();            Random bb = new Random();            Random cc = new Random();            Random mm = new Random();            Random nn = new Random();            a = aa.nextInt(10);            b = bb.nextInt(10);            c = cc.nextInt(4);            m = mm.nextInt(10);            n = nn.nextInt(10);            if(c==0){                if(m==0&&n==0){                    m = mm.nextInt(10)+1;                    n = nn.nextInt(10)+1;                    if(a%m==0&&b%n==0){                        y = a + b;                        System.out.printf(a+"+"+b+"= ");                        Scanner e1 = new Scanner(System.in);                        z = e1.nextInt();                        if(z==y){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+y);                        }                    }else if(a%m==0&&b%n!=0){                        String l = b + "/" + n;                        y = a*n + b ;                        System.out.printf(a+"+"+l+"= ");                        String k =  y + "/"+ n;                        Scanner e6 = new Scanner(System.in);                        String j = e6.next();                        if(j.equals(k)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+k);                        }                    }else if(a%m!=0&&b%n==0){                        String l = a + "/" + m;                        y = a + b*m;                        System.out.printf(l+"+"+b+"= ");                        String k =  y + "/"+ m;                        Scanner e7 = new Scanner(System.in);                        String j = e7.next();                        if(j.equals(k)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+k);                        }                    }else{                        String l1 = a + "/" + m;                        String l2 = b + "/" + n;                        y = a*n + b*m;                        System.out.printf(l1+"+"+l2+"= ");                        String k =  y + "/"+ n*m;                        Scanner e8 = new Scanner(System.in);                        String j = e8.next();                        if(j.equals(k)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+k);                        }                    }                }else if(m==0&&n!=0){                    m = mm.nextInt(10)+1;                    if(a%m==0&&b%n==0){                        y = a + b;                        System.out.printf(a+"+"+b+"= ");                        Scanner e1 = new Scanner(System.in);                        z = e1.nextInt();                        if(z==y){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+y);                        }                    }else if(a%m==0&&b%n!=0){                        String l = b + "/" + n;                        y = a*n + b ;                        System.out.printf(a+"+"+l+"= ");                        String k =  y + "/"+ n;                        Scanner e6 = new Scanner(System.in);                        String j = e6.next();                        if(j.equals(k)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+k);                        }                    }else if(a%m!=0&&b%n==0){                        String l = a + "/" + m;                        y = a + b*m;                        System.out.printf(l+"+"+b+"= ");                        String k =  y + "/"+ m;                        Scanner e7 = new Scanner(System.in);                        String j = e7.next();                        if(j.equals(k)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+k);                        }                    }else{                        String l1 = a + "/" + m;                        String l2 = b + "/" + n;                        y = a*n + b*m;                        System.out.printf(l1+"+"+l2+"= ");                        String k =  y + "/"+ n*m;                        Scanner e8 = new Scanner(System.in);                        String j = e8.next();                        if(j.equals(k)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+k);                        }                    }                }else if(m!=0&&n==0){                    n = nn.nextInt(10)+1;                    if(a%m==0&&b%n==0){                        y = a + b;                        System.out.printf(a+"+"+b+"= ");                        Scanner e1 = new Scanner(System.in);                        z = e1.nextInt();                        if(z==y){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+y);                        }                    }else if(a%m==0&&b%n!=0){                        String l = b + "/" + n;                        y = a*n + b ;                        System.out.printf(a+"+"+l+"= ");                        String k =  y + "/"+ n;                        Scanner e6 = new Scanner(System.in);                        String j = e6.next();                        if(j.equals(k)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+k);                        }                    }else if(a%m!=0&&b%n==0){                        String l = a + "/" + m;                        y = a + b*m;                        System.out.printf(l+"+"+b+"= ");                        String k =  y + "/"+ m;                        Scanner e7 = new Scanner(System.in);                        String j = e7.next();                        if(j.equals(k)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+k);                        }                    }else{                        String l1 = a + "/" + m;                        String l2 = b + "/" + n;                        y = a*n + b*m;                        System.out.printf(l1+"+"+l2+"= ");                        String k =  y + "/"+ n*m;                        Scanner e8 = new Scanner(System.in);                        String j = e8.next();                        if(j.equals(k)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+k);                        }                    }                }else{                    if(a%m==0&&b%n==0){                        y = a + b;                        System.out.printf(a+"+"+b+"= ");                        Scanner e1 = new Scanner(System.in);                        z = e1.nextInt();                        if(z==y){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+y);                        }                    }else if(a%m==0&&b%n!=0){                        String l = b + "/" + n;                        y = a*n + b ;                        System.out.printf(a+"+"+l+"= ");                        String k =  y + "/"+ n;                        Scanner e6 = new Scanner(System.in);                        String j = e6.next();                        if(j.equals(k)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+k);                        }                    }else if(a%m!=0&&b%n==0){                        String l = a + "/" + m;                        y = a + b*m;                        System.out.printf(l+"+"+b+"= ");                        String k =  y + "/"+ m;                        Scanner e7 = new Scanner(System.in);                        String j = e7.next();                        if(j.equals(k)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+k);                        }                    }else{                        String l1 = a + "/" + m;                        String l2 = b + "/" + n;                        y = a*n + b*m;                        System.out.printf(l1+"+"+l2+"= ");                        String k =  y + "/"+ n*m;                        Scanner e8 = new Scanner(System.in);                        String j = e8.next();                        if(j.equals(k)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+k);                        }                    }                }            }            if(c==1){                if(m==0&&n==0){                    m = mm.nextInt(10)+1;                    n = nn.nextInt(10)+1;                    if(a%m==0&&b%n==0){                        y = a - b;                        System.out.printf(a+"-"+b+"= ");                        Scanner e2 = new Scanner(System.in);                        z = e2.nextInt();                        if(z==y){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+y);                        }                }else if(a%m==0&&b%n!=0){                    String l = b + "/" + n;                    y = a*n - b ;                    System.out.printf(a+"-"+l+"= ");                    String k =  y + "/"+ n;                    Scanner e6 = new Scanner(System.in);                    String j = e6.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else if(a%m!=0&&b%n==0){                    String l = a + "/" + m;                    y = a - b*m;                    System.out.printf(l+"-"+b+"= ");                    String k =  y + "/"+ m;                    Scanner e7 = new Scanner(System.in);                    String j = e7.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else{                    String l1 = a + "/" + m;                    String l2 = b + "/" + n;                    y = a*n - b*m;                    System.out.printf(l1+"-"+l2+"= ");                    String k =  y + "/"+ n*m;                    Scanner e8 = new Scanner(System.in);                    String j = e8.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }                }else if(m==0&&n!=0){                m = mm.nextInt(10)+1;                if(a%m==0&&b%n==0){                    y = a - b;                    System.out.printf(a+"-"+b+"= ");                    Scanner e1 = new Scanner(System.in);                    z = e1.nextInt();                    if(z==y){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+y);                    }                }else if(a%m==0&&b%n!=0){                    String l = b + "/" + n;                    y = a*n - b ;                    System.out.printf(a+"-"+l+"= ");                    String k =  y + "/"+ n;                    Scanner e6 = new Scanner(System.in);                    String j = e6.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else if(a%m!=0&&b%n==0){                    String l = a + "/" + m;                    y = a - b*m;                    System.out.printf(l+"-"+b+"= ");                    String k =  y + "/"+ m;                    Scanner e7 = new Scanner(System.in);                    String j = e7.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else{                    String l1 = a + "/" + m;                    String l2 = b + "/" + n;                    y = a*n - b*m;                    System.out.printf(l1+"-"+l2+"= ");                    String k =  y + "/"+ n*m;                    Scanner e8 = new Scanner(System.in);                    String j = e8.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }            }else if(m!=0&&n==0){                n = nn.nextInt(10)+1;                if(a%m==0&&b%n==0){                    y = a - b;                    System.out.printf(a+"-"+b+"= ");                    Scanner e1 = new Scanner(System.in);                    z = e1.nextInt();                    if(z==y){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+y);                    }                }else if(a%m==0&&b%n!=0){                    String l = b + "/" + n;                    y = a*n - b ;                    System.out.printf(a+"-"+l+"= ");                    String k =  y + "/"+ n;                    Scanner e6 = new Scanner(System.in);                    String j = e6.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else if(a%m!=0&&b%n==0){                    String l = a + "/" + m;                    y = a - b*m;                    System.out.printf(l+"-"+b+"= ");                    String k =  y + "/"+ m;                    Scanner e7 = new Scanner(System.in);                    String j = e7.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else{                    String l1 = a + "/" + m;                    String l2 = b + "/" + n;                    y = a*n - b*m;                    System.out.printf(l1+"-"+l2+"= ");                    String k =  y + "/"+ n*m;                    Scanner e8 = new Scanner(System.in);                    String j = e8.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }            }else{                if(a%m==0&&b%n==0){                    y = a - b;                    System.out.printf(a+"-"+b+"= ");                    Scanner e1 = new Scanner(System.in);                    z = e1.nextInt();                    if(z==y){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+y);                    }                }else if(a%m==0&&b%n!=0){                    String l = b + "/" + n;                    y = a*n - b ;                    System.out.printf(a+"-"+l+"= ");                    String k =  y + "/"+ n;                    Scanner e6 = new Scanner(System.in);                    String j = e6.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else if(a%m!=0&&b%n==0){                    String l = a + "/" + m;                    y = a - b*m;                    System.out.printf(l+"-"+b+"= ");                    String k =  y + "/"+ m;                    Scanner e7 = new Scanner(System.in);                    String j = e7.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else{                    String l1 = a + "/" + m;                    String l2 = b + "/" + n;                    y = a*n - b*m;                    System.out.printf(l1+"-"+l2+"= ");                    String k =  y + "/"+ n*m;                    Scanner e8 = new Scanner(System.in);                    String j = e8.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }            }            }            if(c==2){                if(m==0&&n==0){                    m = mm.nextInt(10)+1;                    n = nn.nextInt(10)+1;                    if(a%m==0&&b%n==0){                        y = a * b;                        System.out.printf(a+"x"+b+"= ");                        Scanner e3 = new Scanner(System.in);                        z = e3.nextInt();                        if(z==y){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+y);                        }                }else if(a%m==0&&b%n!=0){                    String l = b + "/" + n;                    y = a*b ;                    System.out.printf(a+"x"+l+"= ");                    String k =  y + "/"+ n;                    Scanner e6 = new Scanner(System.in);                    String j = e6.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else if(a%m!=0&&b%n==0){                    String l = a + "/" + m;                    y = b*a;                    System.out.printf(l+"x"+b+"= ");                    String k =  y + "/"+ m;                    Scanner e7 = new Scanner(System.in);                    String j = e7.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else{                    String l1 = a + "/" + m;                    String l2 = b + "/" + n;                    y = a*b;                    System.out.printf(l1+"x"+l2+"= ");                    String k =  y + "/"+ n*m;                    Scanner e8 = new Scanner(System.in);                    String j = e8.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }                }else if(m==0&&n!=0){                m = mm.nextInt(10)+1;                if(a%m==0&&b%n==0){                    y = a * b;                    System.out.printf(a+"x"+b+"= ");                    Scanner e1 = new Scanner(System.in);                    z = e1.nextInt();                    if(z==y){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+y);                    }                }else if(a%m==0&&b%n!=0){                    String l = b + "/" + n;                    y = a*b;                    System.out.printf(a+"x"+l+"= ");                    String k =  y + "/"+ n;                    Scanner e6 = new Scanner(System.in);                    String j = e6.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else if(a%m!=0&&b%n==0){                    String l = a + "/" + m;                    y = a*b;                    System.out.printf(l+"x"+b+"= ");                    String k =  y + "/"+ m;                    Scanner e7 = new Scanner(System.in);                    String j = e7.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else{                    String l1 = a + "/" + m;                    String l2 = b + "/" + n;                    y = a*b;                    System.out.printf(l1+"x"+l2+"= ");                    String k =  y + "/"+ n*m;                    Scanner e8 = new Scanner(System.in);                    String j = e8.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }            }else if(m!=0&&n==0){                n = nn.nextInt(10)+1;                if(a%m==0&&b%n==0){                    y = a * b;                    System.out.printf(a+"x"+b+"= ");                    Scanner e1 = new Scanner(System.in);                    z = e1.nextInt();                    if(z==y){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+y);                    }                }else if(a%m==0&&b%n!=0){                    String l = b + "/" + n;                    y = a*b ;                    System.out.printf(a+"x"+l+"= ");                    String k =  y + "/"+ n;                    Scanner e6 = new Scanner(System.in);                    String j = e6.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else if(a%m!=0&&b%n==0){                    String l = a + "/" + m;                    y = a*b;                    System.out.printf(l+"x"+b+"= ");                    String k =  y + "/"+ m;                    Scanner e7 = new Scanner(System.in);                    String j = e7.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else{                    String l1 = a + "/" + m;                    String l2 = b + "/" + n;                    y = a*b;                    System.out.printf(l1+"x"+l2+"= ");                    String k =  y + "/"+ n*m;                    Scanner e8 = new Scanner(System.in);                    String j = e8.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }            }else{                if(a%m==0&&b%n==0){                    y = a * b;                    System.out.printf(a+"x"+b+"= ");                    Scanner e1 = new Scanner(System.in);                    z = e1.nextInt();                    if(z==y){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+y);                    }                }else if(a%m==0&&b%n!=0){                    String l = b + "/" + n;                    y = a*b ;                    System.out.printf(a+"x"+l+"= ");                    String k =  y + "/"+ n;                    Scanner e6 = new Scanner(System.in);                    String j = e6.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else if(a%m!=0&&b%n==0){                    String l = a + "/" + m;                    y = a*b;                    System.out.printf(l+"x"+b+"= ");                    String k =  y + "/"+ m;                    Scanner e7 = new Scanner(System.in);                    String j = e7.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else{                    String l1 = a + "/" + m;                    String l2 = b + "/" + n;                    y = a*b;                    System.out.printf(l1+"x"+l2+"= ");                    String k =  y + "/"+ n*m;                    Scanner e8 = new Scanner(System.in);                    String j = e8.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }            }            }            if(c==3){                if(b==0){                    b = bb.nextInt(10)+1;                    if(m==0&&n==0){                        m = mm.nextInt(10)+1;                        n = nn.nextInt(10)+1;                        if(a%m==0&&b%n==0){                            if(a%b!=0){                                String l=a+"/"+b;                            System.out.printf(a+"÷"+b+"= ");                            Scanner e4 = new Scanner(System.in);                            String p1 = e4.next();                            if(p1.equals(l)){                                System.out.println("回答正确!");                                h++;                            }else{                                System.out.println("回答错误!正确答案是"+l);                            }                            }else{                                p = a / b;                                System.out.printf(a+"÷"+b+"= ");                                Scanner e5 = new Scanner(System.in);                                g = e5.nextInt();                                if(p==g){                                    System.out.println("回答正确!");                                    h++;                                }else{                                    System.out.println("回答错误!正确答案是"+p);                                }                            }                    }else if(a%m==0&&b%n!=0){                        String l = b + "/" + n;                        if(a==0){System.out.println(a+"÷"+l+"= ");                        Scanner e6 = new Scanner(System.in);                        p = e6.nextInt();                        if(p==0){System.out.println("回答正确!");h++;                        continue;}else{System.out.println("回答错误!正确答案是0");continue;}                        }                        y = a*n ;                        System.out.printf(a+"÷"+l+"= ");                        String k =  y + "/"+ b;                        Scanner e6 = new Scanner(System.in);                        String j = e6.next();                        if(j.equals(k)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+k);                        }                    }else if(a%m!=0&&b%n==0){                        String l = a + "/" + m;                        y = a;                        System.out.printf(l+"÷"+b+"= ");                        String k =  y + "/"+ m*b;                        Scanner e7 = new Scanner(System.in);                        String j = e7.next();                        if(j.equals(k)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+k);                        }                    }else{                        String l1 = a + "/" + m;                        String l2 = b + "/" + n;                        y = a*n;                        System.out.printf(l1+"÷"+l2+"= ");                        String k =  y + "/"+ b*m;                        Scanner e8 = new Scanner(System.in);                        String j = e8.next();                        if(j.equals(k)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+k);                        }                    }                    }else if(m==0&&n!=0){                    m = mm.nextInt(10)+1;                    if(a%m==0&&b%n==0){                        if(a%b!=0){                            String l=a+"/"+b;                        System.out.printf(a+"÷"+b+"= ");                        Scanner e4 = new Scanner(System.in);                        String p1 = e4.next();                        if(p1.equals(l)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+l);                        }                        }else{                            p = a / b;                            System.out.printf(a+"÷"+b+"= ");                            Scanner e5 = new Scanner(System.in);                            g = e5.nextInt();                            if(p==g){                                System.out.println("回答正确!");                                h++;                            }else{                                System.out.println("回答错误!正确答案是"+p);                            }                        }                }else if(a%m==0&&b%n!=0){                    String l = b + "/" + n;                    if(a==0){System.out.println(a+"÷"+l+"= ");                    Scanner e6 = new Scanner(System.in);                    p = e6.nextInt();                    if(p==0){System.out.println("回答正确!");h++;                    continue;}else{System.out.println("回答错误!正确答案是0");continue;}                    }                    y = a*n ;                    System.out.printf(a+"÷"+l+"= ");                    String k =  y + "/"+ b;                    Scanner e7 = new Scanner(System.in);                    String j = e7.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else if(a%m!=0&&b%n==0){                    String l = a + "/" + m;                    y = a;                    System.out.printf(l+"÷"+b+"= ");                    String k =  y + "/"+ m*b;                    Scanner e7 = new Scanner(System.in);                    String j = e7.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else{                    String l1 = a + "/" + m;                    String l2 = b + "/" + n;                    y = a*n;                    System.out.printf(l1+"÷"+l2+"= ");                    String k =  y + "/"+ b*m;                    Scanner e8 = new Scanner(System.in);                    String j = e8.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }                }else if(m!=0&&n==0){                    n = nn.nextInt(10)+1;                    if(a%m==0&&b%n==0){                        if(a%b!=0){                            String l=a+"/"+b;                        System.out.printf(a+"÷"+b+"= ");                        Scanner e4 = new Scanner(System.in);                        String p1 = e4.next();                        if(p1.equals(l)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+l);                        }                        }else{                            p = a / b;                            System.out.printf(a+"÷"+b+"= ");                            Scanner e5 = new Scanner(System.in);                            g = e5.nextInt();                            if(p==g){                                System.out.println("回答正确!");                                h++;                            }else{                                System.out.println("回答错误!正确答案是"+p);                            }                        }                }else if(a%m==0&&b%n!=0){                    String l = b + "/" + n;                    if(a==0){System.out.println(a+"÷"+l+"= ");                    Scanner e6 = new Scanner(System.in);                    p = e6.nextInt();                    if(p==0){System.out.println("回答正确!");h++;                    continue;}else{System.out.println("回答错误!正确答案是0");continue;}                    }                    y = a*n ;                    System.out.printf(a+"÷"+l+"= ");                    String k =  y + "/"+ b;                    Scanner e7 = new Scanner(System.in);                    String j = e7.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else if(a%m!=0&&b%n==0){                    String l = a + "/" + m;                    y = a;                    System.out.printf(l+"÷"+b+"= ");                    String k =  y + "/"+ m*b;                    Scanner e7 = new Scanner(System.in);                    String j = e7.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else{                    String l1 = a + "/" + m;                    String l2 = b + "/" + n;                    y = a*n;                    System.out.printf(l1+"÷"+l2+"= ");                    String k =  y + "/"+ b*m;                    Scanner e8 = new Scanner(System.in);                    String j = e8.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }                }else{                    if(a%m==0&&b%n==0){                        if(a%b!=0){                            String l=a+"/"+b;                        System.out.printf(a+"÷"+b+"= ");                        Scanner e4 = new Scanner(System.in);                        String p1 = e4.next();                        if(p1.equals(l)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+l);                        }                        }else{                            p = a / b;                            System.out.printf(a+"÷"+b+"= ");                            Scanner e5 = new Scanner(System.in);                            g = e5.nextInt();                            if(p==g){                                System.out.println("回答正确!");                                h++;                            }else{                                System.out.println("回答错误!正确答案是"+p);                            }                        }                }else if(a%m==0&&b%n!=0){                    String l = b + "/" + n;                    if(a==0){System.out.println(a+"÷"+l+"= ");                    Scanner e6 = new Scanner(System.in);                    p = e6.nextInt();                    if(p==0){System.out.println("回答正确!");h++;                    continue;}else{System.out.println("回答错误!正确答案是0");continue;}                    }                    y = a*n ;                    System.out.printf(a+"÷"+l+"= ");                    String k =  y + "/"+ b;                    Scanner e6 = new Scanner(System.in);                    String j = e6.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else if(a%m!=0&&b%n==0){                    String l = a + "/" + m;                    y = a;                    System.out.printf(l+"÷"+b+"= ");                    String k =  y + "/"+ m*b;                    Scanner e7 = new Scanner(System.in);                    String j = e7.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else{                    String l1 = a + "/" + m;                    String l2 = b + "/" + n;                    y = a*n;                    System.out.printf(l1+"÷"+l2+"= ");                    String k =  y + "/"+ b*m;                    Scanner e8 = new Scanner(System.in);                    String j = e8.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }                }                }else{                //p =(float) a / b;                    if(m==0&&n==0){                        m = mm.nextInt(10)+1;                        n = nn.nextInt(10)+1;                        if(a%m==0&&b%n==0){                            if(a%b!=0){                                String l=a+"/"+b;                            System.out.printf(a+"÷"+b+"= ");                            Scanner e4 = new Scanner(System.in);                            String p1 = e4.next();                            if(p1.equals(l)){                                System.out.println("回答正确!");                                h++;                            }else{                                System.out.println("回答错误!正确答案是"+l);                            }                            }else{                                p = a / b;                                System.out.printf(a+"÷"+b+"= ");                                Scanner e5 = new Scanner(System.in);                                g = e5.nextInt();                                if(p==g){                                    System.out.println("回答正确!");                                    h++;                                }else{                                    System.out.println("回答错误!正确答案是"+p);                                }                            }                    }else if(a%m==0&&b%n!=0){                        String l = b + "/" + n;                        y = a*n ;                        System.out.printf(a+"÷"+l+"= ");                        String k =  y + "/"+ b;                        Scanner e6 = new Scanner(System.in);                        String j = e6.next();                        if(j.equals(k)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+k);                        }                    }else if(a%m!=0&&b%n==0){                        String l = a + "/" + m;                        if(a==0){System.out.println(a+"÷"+l+"= ");                        Scanner e6 = new Scanner(System.in);                        p = e6.nextInt();                        if(p==0){System.out.println("回答正确!");h++;                        continue;}else{System.out.println("回答错误!正确答案是0");continue;}                        }                        y = a;                        System.out.printf(l+"÷"+b+"= ");                        String k =  y + "/"+ m*b;                        Scanner e7 = new Scanner(System.in);                        String j = e7.next();                        if(j.equals(k)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+k);                        }                    }else{                        String l1 = a + "/" + m;                        String l2 = b + "/" + n;                        y = a*n;                        System.out.printf(l1+"÷"+l2+"= ");                        String k =  y + "/"+ b*m;                        Scanner e8 = new Scanner(System.in);                        String j = e8.next();                        if(j.equals(k)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+k);                        }                    }                    }else if(m==0&&n!=0){                    m = mm.nextInt(10)+1;                    if(a%m==0&&b%n==0){                        if(a%b!=0){                            String l=a+"/"+b;                        System.out.printf(a+"÷"+b+"= ");                        Scanner e4 = new Scanner(System.in);                        String p1 = e4.next();                        if(p1.equals(l)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+l);                        }                        }else{                            p = a / b;                            System.out.printf(a+"÷"+b+"= ");                            Scanner e5 = new Scanner(System.in);                            g = e5.nextInt();                            if(p==g){                                System.out.println("回答正确!");                                h++;                            }else{                                System.out.println("回答错误!正确答案是"+p);                            }                        }                }else if(a%m==0&&b%n!=0){                    String l = b + "/" + n;                    if(a==0){System.out.println(a+"÷"+l+"= ");                    Scanner e6 = new Scanner(System.in);                    p = e6.nextInt();                    if(p==0){System.out.println("回答正确!");h++;                    continue;}else{System.out.println("回答错误!正确答案是0");continue;}                    }                    y = a*n ;                    System.out.printf(a+"÷"+l+"= ");                    String k =  y + "/"+ b;                    Scanner e6 = new Scanner(System.in);                    String j = e6.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else if(a%m!=0&&b%n==0){                    String l = a + "/" + m;                    y = a;                    System.out.printf(l+"÷"+b+"= ");                    String k =  y + "/"+ m*b;                    Scanner e7 = new Scanner(System.in);                    String j = e7.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else{                    String l1 = a + "/" + m;                    String l2 = b + "/" + n;                    y = a*n;                    System.out.printf(l1+"÷"+l2+"= ");                    String k =  y + "/"+ b*m;                    Scanner e8 = new Scanner(System.in);                    String j = e8.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }                }else if(m!=0&&n==0){                    n = nn.nextInt(10)+1;                    if(a%m==0&&b%n==0){                        if(a%b!=0){                            String l=a+"/"+b;                        System.out.printf(a+"÷"+b+"= ");                        Scanner e4 = new Scanner(System.in);                        String p1 = e4.next();                        if(p1.equals(l)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+l);                        }                        }else{                            p = a / b;                            System.out.printf(a+"÷"+b+"= ");                            Scanner e5 = new Scanner(System.in);                            g = e5.nextInt();                            if(p==g){                                System.out.println("回答正确!");                                h++;                            }else{                                System.out.println("回答错误!正确答案是"+p);                            }                        }                }else if(a%m==0&&b%n!=0){                    String l = b + "/" + n;                    if(a==0){System.out.println(a+"÷"+l+"= ");                    Scanner e6 = new Scanner(System.in);                    p = e6.nextInt();                    if(p==0){System.out.println("回答正确!");h++;                    continue;}else{System.out.println("回答错误!正确答案是0");continue;}                    }                    y = a*n ;                    System.out.printf(a+"÷"+l+"= ");                    String k =  y + "/"+ b;                    Scanner e7 = new Scanner(System.in);                    String j = e7.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else if(a%m!=0&&b%n==0){                    String l = a + "/" + m;                    y = a;                    System.out.printf(l+"÷"+b+"= ");                    String k =  y + "/"+ m*b;                    Scanner e7 = new Scanner(System.in);                    String j = e7.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else{                    String l1 = a + "/" + m;                    String l2 = b + "/" + n;                    y = a*n;                    System.out.printf(l1+"÷"+l2+"= ");                    String k =  y + "/"+ b*m;                    Scanner e8 = new Scanner(System.in);                    String j = e8.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }                }else{                    if(a%m==0&&b%n==0){                        if(a%b!=0){                            String l=a+"/"+b;                        System.out.printf(a+"÷"+b+"= ");                        Scanner e4 = new Scanner(System.in);                        String p1 = e4.next();                        if(p1.equals(l)){                            System.out.println("回答正确!");                            h++;                        }else{                            System.out.println("回答错误!正确答案是"+l);                        }                        }else{                            p = a / b;                            System.out.printf(a+"÷"+b+"= ");                            Scanner e5 = new Scanner(System.in);                            g = e5.nextInt();                            if(p==g){                                System.out.println("回答正确!");                                h++;                            }else{                                System.out.println("回答错误!正确答案是"+p);                            }                        }                }else if(a%m==0&&b%n!=0){                    String l = b + "/" + n;                    if(a==0){System.out.println(a+"÷"+l+"= ");                    Scanner e6 = new Scanner(System.in);                    p = e6.nextInt();                    if(p==0){System.out.println("回答正确!");h++;                    continue;}else{System.out.println("回答错误!正确答案是0");continue;}                    }                    y = a*n ;                    System.out.printf(a+"÷"+l+"= ");                    String k =  y + "/"+ b;                    Scanner e7 = new Scanner(System.in);                    String j = e7.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else if(a%m!=0&&b%n==0){                    String l = a + "/" + m;                    y = a;                    System.out.printf(l+"÷"+b+"= ");                    String k =  y + "/"+ m*b;                    Scanner e7 = new Scanner(System.in);                    String j = e7.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }else{                    String l1 = a + "/" + m;                    String l2 = b + "/" + n;                    y = a*n;                    System.out.printf(l1+"÷"+l2+"= ");                    String k =  y + "/"+ b*m;                    Scanner e8 = new Scanner(System.in);                    String j = e8.next();                    if(j.equals(k)){                        System.out.println("回答正确!");                        h++;                    }else{                        System.out.println("回答错误!正确答案是"+k);                    }                }                }                }            }        }        System.out.println("总共"+x+"题,"+"恭喜答对"+h+"题");        System.out.println("正确率为"+(float)h/x);    }}

      显示结果:

    4. PSP表格                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    5. 小结感受:结对编程真的能够带来1+1>2的效果吗?通过这次结对编程,请谈谈你的感受和体会。

      答:这次的结对编程让我深深感觉到编程的难度,并且有着许多需要自己掌握的地方,现在的我需要继续的努力来弥补自己的不足和落后

转载于:https://www.cnblogs.com/jbc1132/p/8646353.html

你可能感兴趣的文章
java中的Volatile关键字
查看>>
前端自定义图标
查看>>
实验二
查看>>
独立开发一个云(PaaS)的核心要素, Go, Go, Go!!!
查看>>
网站文章如何能自动判定是抄袭?一种算法和实践架构剖析
查看>>
【OpenCV学习】滚动条
查看>>
ofo用科技引领行业进入4.0时代 用户粘性连续8个月远甩摩拜
查看>>
兰州青年志愿者“中西合璧”玩快闪 温暖旅客回家路
查看>>
计划10年建10万廉价屋 新西兰政府:比想象中难
查看>>
甘肃发首版《3D打印职业教育教材》:校企合作育专才
查看>>
为找好心人抚养孩子 浙江一离婚父亲将幼童丢弃公园
查看>>
晚婚晚育 近20年巴西35岁以上孕妇增加65%
查看>>
读书:为了那个美妙的咔哒声
查看>>
jsp改造之sitemesh注意事项
查看>>
iOS 9.0之后NSString encode方法替换
查看>>
ASMFD (ASM Filter Driver) Support on OS Platforms (Certification Matrix). (文档 ID 2034681.1)
查看>>
CRM Transaction处理中的权限控制
查看>>
[转]linux创建链接文件的两种方法
查看>>
python ipaddress模块使用
查看>>
文件权限
查看>>