demand analysis
In order to facilitate the students to improve computational abilities, and the parents do not pay too much time and effort to solve this problem through this program.
The basic functions of
an automatic four arithmetic formula to generate two operands within 10 100 (+ - * /), operation results are required within 100
2, discarding duplicates equation. = 2 + 3 + 3 = 2 and Equation 2 is repeated and 3 + = 3 + 2 = not repeated formula
3, the number of items can be customized
4, the control parameters may contain multiplication and division, the number of controllable operation range of values (e.g., less than 100 or operand within 1000), whether or not containing a negative operand
5, the generated file to an external memory operation problems in result.txt
feature design
1.import.Java.until*;
2.输入:Scanner reader=new Scanner(System.in);
Math class methods Radom of: generating a random number 3.
4.for the circulation and use if else
Test shots.
code segment
Using random numbers
int a = (int) (Math.random() * 100); int b = (int) (Math.random() * 100);
Operational control
System.out.println ( "Please select operation within 100 or within the operation 1000"); Nl = sc.nextInt () System.out.println ( "Please enter the number of questions to be produced"); N2 of sc.nextInt = () System.out.println ( "input 1 comprising multiplication and division, excluding 0"); N3 = sc.nextInt (); System.out.println ( "not containing a negative input, comprising negative 0"); N4 = sc.nextInt ();
Switch control operation
switch (b) { case 0: r=m1+m2; break; case 1: r=m1-m2; break; case 2: r=m1*m2; break; case 3: r=m1/m2; break; default: break; }
to sum up
The use of java is not very skilled, especially the use of recycled order, and I am not very neat when playing program, conditioning is not very clear, so it should be positive to practice.
PSP
PSP | SUMMARY | Plan time required to complete a total of | Time required to achieve complete |
planning | Program content | 15 | 10 |
Estimate | Design steps | 20 | 15 |
Develomopment | Developing content | 70 | 90 |
Anailsis | demand analysis | 20 | 10 |
Design | Specific design | 90 | 90 |
Coding | test | 50 | 60 |
Test | report | 20 | 10 |
Reporting | to sum up | 10 | 5 |