zoukankan      html  css  js  c++  java
  • 结对编程(二)

    结对对象:黄蓉蓉  学号:2013110417  博客地址:http://www.cnblogs.com/hrrpcy/

    双方贡献比例:1:1

    结对编程照片:

    源代码:

    package com.hrr.arithmetic;

    import java.util.Random;
    import java.util.Scanner;

    public class ArithmeticTest {
    public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    Random random = new Random();
    int num = 0;// 控制题目数量
    int opA, opB;// 定义两个操作数
    int result = 0;
    Boolean flag = true;
    String[] operator = { "+", "-", "×", "÷" };
    // String problem = null;

    while (num < 30) {
    opA = random.nextInt(100);
    opB = random.nextInt(100);
    String op;
    op = operator[random.nextInt(operator.length)];
    while (flag) {
    if (op == "÷") {
    while (opA < opB || opB == 0 || opA % opB != 0) {
    opA = random.nextInt(100);
    opB = random.nextInt(100);
    }
    result = opA / opB;
    } else if (op == "-") {
    while (opA < opB) {
    opA = random.nextInt(100);
    opB = random.nextInt(100);
    }
    result = opA - opB;
    } else if (op == "+") {
    result = opA + opB;
    } else if (op == "×") {
    result = opA * opB;
    }
    if (result > 100) {
    opA = random.nextInt(100);
    opB = random.nextInt(100);
    op = operator[random.nextInt(operator.length)];
    flag = true;
    } else {
    flag = false;
    }
    }
    flag = true;
    num++;
    System.out.println(num + "、 " + opA + op + opB + "=" + " ");

    }

    }
    }

    运行结果:

    点滴成就 学习时间 新编写代码行数 博客量 学到知识点
    第一周 6h 0 0 初步了解软件工程
    第二周 6h 0 1

    认识软件工程

    第三周 10h 0 1 制作调查问卷、了解需求文档
    第四周 6h 15 1 学习写好需求文档、结对编程
    第五周 10h 0 0 状态图、顺序图的绘制
    第六周 12h 30 0 写系统详细设计说明书
    第七周 12h 30 1 写系统详细设计说明书
  • 相关阅读:
    JSDoc使用指南
    听创始人讲Quora为什么选择Python
    Bootstrap model模态框与百度地图API发生冲突时的解决办法
    使用百度地图API制作线路轨迹播放
    EF+Mysql+DDD框架搭建(一)——code first准备
    RowNumber()分页方法
    设计模式六大原则
    温习.net基础知识(二)装箱和拆箱
    温习.net基础知识(一)基础知识点
    c# 跨域api
  • 原文地址:https://www.cnblogs.com/Issing/p/5369133.html
Copyright © 2011-2022 走看看