Automatically generated four arithmetic equation

First, the needs analysis

Four operations need to automatically generate a program questions, ranging from less than 100, whether or not containing the operands is negative, discarding duplicates formula, result.txt file in the external display .

Second, the functional implementation:

·basic skills

(1) automatically generates four arithmetic operation of Equation 2 number less than 10 100 (+ - * /), operation results are required within 100

Number (2) title can be customized.

(3) parameters can be controlled.

          Whether to include multiplication and division.

          Operand controllable range of values ​​(e.g., operands within 100 or within 1000).

          Whether operands containing negative.  

Third, the design and implementation:

1. The incoming packet.

import java.io.FileNotFoundException;

import java.io.PrintStream;

import java.util.Scanner;

java.util.Random import;

2. The use of a random number generated random achieve '

= R & lt new new the Random the Random ();
int r.nextInt A = () + 100%. 1; // range generated number is less than 100
int r.nextInt B = () + 100%. 1; // number generation range is less than 100

3. The use of the Java language as well as some of the ways to achieve the basic functions.

 Fourth, the test run:

The basic testing function and automatically generates four arithmetic operation of Equation 2 number less than 10 100 (+ - * /), are less than 100 requires the calculation result. Including multiplication and division, the controllable range of values ​​of the operands (e.g., operands within 100 or within 1000), whether the operand also containing a controllable negative.

 

Five more satisfied snippet:

System.out.print ( "Please enter the number of Title:");
int a Tg of t.nextInt = ();
// number of control subject

System.out.print("请输入操作数的范围(如 100,1000等):");
int tf = t.nextInt();
//控制题目范围


System.out.println("请选择是否有负数:1:有 0:没有");
int zf = t.nextInt();
//控制正负数


System.out.println("请选择是否包含*或者/:2:否 4:是 ");
int fu = t.nextInt();
//控制符号

System.setOut(ps);

六、总结

觉得自己以前学习的东西都忘了好多,看到题目时的第一个想法就是“我不会”,后来翻看了一下以前的课本,又去网上百度了一下一些方法,实现了一些基本功能,五个基本功能,我只实现了三个,

查重和存储到外部文件并没有实现,以后会继续努力,不断实现。

 

七、PSP

PSP2.1

任务内容

计划共完成需要的时间(min)

实际完成需要的时间(min)

Planning

计划

10

15

·       Estimate

·  估计这个任务需要多少时间,并规划大致工作步骤

5

6

Development

开发

60

120

··       Analysis

  需求分析 (包括学习新技术)

20

50

·       Design Spec

·  生成设计文档

10

15

·       Design Review

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

5

10

·       Coding Standard

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

5

5

·       Design

  具体设计

20

30

·       Coding

  具体编码

30

50

·       Code Review

·  代码复审

5

10

·       Test

·  测试(自我测试,修改代码,提交修改)

9

15

Reporting

报告

10

20

··       Test Report

·  测试报告

3

3

·       Size Measurement

  计算工作量

2

1

·       Postmortem & Process Improvement Plan

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

5

5

 

 

 

Guess you like

Origin www.cnblogs.com/yangliewei/p/11526184.html