1 needs analysis
Parents of children in order to improve computational abilities, needs every day to the children out of the question, which needs to make a program that generates a certain number of non-repeating topics every day, parents decomposition pressure.
2 Functional Design
basic skills:
(1) automatically generates four arithmetic operation of Equation 2 number less than 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
Number (3) title can be customized
(4) parameters can be controlled
Whether to include multiplication and division
Controllable range values of the operands (e.g., operands within 100 or within 1000)
Whether operands containing negative
(5) generating operation to an external file title stored in result.txt
3 Design and Implementation
Scanner using the constructor PrintStream, new new PrintStream PrintStream S = ( "D: /result.txt");
System.setOut (S); this function is called, may be all System.out.println (); output statement, we print the files created folder
Scanner Scanner new new T = ( the System.in); we control input from the keyboard
Math.random (); generating a random function will not be repeated
4 Test Run
Fragment 5
class A {public
public static void main (String [] args) {throws a FileNotFoundException
PrintStream PrintStream new new S = ( "D: /result.txt");
int C;
Scanner Scanner new new T = (the System.in);
the System.out .print ( "Please enter the number of Title:");
int t.nextInt (TM) = ();
// number of the control subject
System.out.print ( "Please enter operand range (e.g., 100, 1000, etc.):" );
int t.nextInt TF = ();
// topic range control
System.out.println ( "Please choose whether there are negative numbers: 1: 0: no");
int t.nextInt ZF = ();
// control positive and negative numbers
System.out.println ( "Please choose whether to include or * /: 2: No 4: is");
int t.nextInt FU = ();
// control symbols
System.setOut (s);
IF (ZF == 0) { // No negative of System.out.print (A); } IF (FU == 2) { // Select two characters '+' '-' int K = ( int ) (the Math .random () * 2 ); Switch (K) { // randomly selected operator Case 0: of System.out.print ( "+" ); BREAK ; Case . 1: of System.out.print ( "-" ); BREAK ;
Summary 6
My program is not a good foundation, write some code can achieve the basic functions, there is no expansion capabilities, we hope to continue to strengthen in the future of learning. There are some difficulties in achieving the function, but also in the process learned some experience.
7 PSP
PSP2.1 |
SUMMARY |
Plan time (min) required to complete a total of |
The actual time required for completion (min) |
Planning |
plan |
10 |
20 |
· Estimate |
· Estimate how much time this task requires, and planning generally work steps |
60 |
120 |
Development |
Develop |
30 |
40 |
·· Analysis |
Needs analysis (including learning new technologies) |
60 |
60 |
· Design Spec |
Generate design documents |
20 |
20 |
· Design Review |
· Design Review (and his colleagues reviewed the design documents) |
20 |
20 |
· Coding Standard |
Code specifications (development of appropriate norms for the current development) |
10 |
15 |
· Design |
Specific design |
10 |
10 |
· Coding |
Specific coding |
50 |
60 |
· Code Review |
· Code Review |
10 |
10 |
· Test |
· Test (self-test, modify the code, submit modifications) |
5 |
10 |
Reporting |
report |
10 |
10 |
·· Test Report |
· testing report |
15 |
10 |
· Size Measurement |
Computing workload |
5 |
5 |
· Postmortem & Process Improvement Plan |
· Hindsight, and propose process improvement plan |
20 |
20 |