The only way to success

First, the needs analysis

  With the era of progress and development of technology, people's life toward a higher level forward, gradually, pen and paper is the keyboard, the mouse substitute. People's environmental awareness gradually increased, a lot of work, study conducted online, rather than a simple pen and paper operations.

Second, the functional design

  2.1 Basic functions

    (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

  2.2 extensions

    Able to check your answers are correct

Third, the design and implementation

  HomeWorkDemo_1 class, the main class Fun write (), a function of two parameters, the subject can set the number and range of values, by calling in the main function, the setting can be accomplished. The main role of the function randomly generated number, calculates randomly. The results of each calculation formula can not exceed 100. Randomly generated number stored into an array, each of the two numbers stored answers to another array. By determining the number of the second array is greater than the cover 100 to determine whether a set of data. The final equation using the input file to the specified directory.

    FW = FileWriter null ; 
        BufferedWriter, BUFW = null ;
         the try { 
            FW = new new FileWriter ( "D: \\ the result.txt", to true ); 
            BUFW = new new BufferedWriter, (FW); 
to determine whether the second parameter by FileWriter save a few the math times

Fourth, the test run

  

 

 

for(int i = 0;i<count;i++) {
			num[number_1++] = random.nextInt(scope)+1;
			num[number_1++] = random.nextInt(scope)+1;
			number_5 = random.nextInt(4)+1;
			int flag = number_5%4;
			switch(flag) {
				case 0:total[number_3++] = (num[number_2++])+(num[number_2++]);break;
				case 1:total[number_3++] = (num[number_2++])-(num[number_2++]);break;
				case 2:total[number_3++] = (num[number_2++])*(num[number_2++]);break;
				case 3:total[number_3++] = (num[number_2++])/(num[number_2++]);break;
			}
			symbol[number_6++] = flag;
			if(number_4<=count) {
				if(total[number_4++]>100) {
					number_1--;
					number_1--;
					number_2--;
					number_2--; 
					number_3--; 
					number_4--; 
					number_6--; 
					COUNT ++; 
				} 
			}	 
The method is not very good. If there is any better way, we can communicate together

  Five, PSP

PSP2.1 SUMMARY Plan time (min) required to complete a total of The actual time required for completion (min)
Planning plan 120 180
    Estimate · Estimate how much time this task requires, and planning generally work steps 120 180
Development Develop 80 120
Analysis   Needs analysis (including learning new technologies) 20 20
    Design Spec Generate design documents 10 4
Design Review   Design review (and colleagues reviewed the design documents) 10 10
Coding Standard  Code specifications (development of appropriate norms for the current development) 1 1
 Design  Specific design 3 10
Coding Specific coding 4 10
Code Review  Code Review 12 5
 Test · Test (self-test, modify the code, submit modifications) 10 10
Reporting report 17 10
  Test Report  testing report 10 5
Size Measurement Computing workload 10 5
   Postmortem & Process Improvement Plan Later summarized, and process improvement plan 5 5

 

Guess you like

Origin www.cnblogs.com/xiexiaofei/p/11482504.html