2019 Software engineering twinning projects -1120172176

## 1. Project members and Github project addresses
| project members | blog address | github address |
| - | - | - |
| Lujun Qi | | HTTPS: //github.com/SaltyFishL/AutoCal | 
| Wu Dawei | | https://github.com/AmnesiaWu/AutoCal |

## 2. PSP table
| PSP2.1 | Personal Software Process Stages | Estimated time consuming (minutes) | actual time-consuming (minutes)
|: - |: - | - | - |
| Planning | program | 30 | |
| · estimate | · estimated that this task requires much time | 30 | |
| development | development | 1980 | 
| · the analysis | needs analysis (including learning new technologies) | 90 | |
| · design the Spec | · generate design documentation | 90 | | 
| · design review | · design review (and his colleagues reviewed the design documents) | 60 | |
| · Coding Standard | · code specifications (to develop an appropriate specification for the current development) | 30 | |
| · design | · The specific design | 120 | |
| · coding | · particular coding | 1200 | |
| · Code Review | · code review | 90 | |
| · the test | · test (self-testing, modifying code, commit changes) | 300 | |
| reporting | report | 200 | |
| · the test report | · test report | 120 | |
| · Size the Measurement | · computing workload | 10 | |
| · Postmortem & Process Improvement Plan | · hindsight, and propose process improvement plan | 70 | |
| | Total | 2210 | |

## 3. problem-solving ideas description
### 3.1 Project Requirements
3.1.1 The first phase ####
* write can automatically generate a primary topic of the four operations command line "Software"
* implement a one-time generation of -i num Title number
* to achieve a maximum of 10 evaluates the expression operators
* support proper fraction of the four arithmetic operations
* implementation decisions wrong, and finally giving a total of right / wrong number.
The second stage #### 3.1.2
* exponentiation support, command line parameters ^ -m 1 is represented by power, command line parameters -m 2 ** expressed as power.
#### 3.1.3 The third phase
* The computer graphics programming interface program on a Windows
* Increase countdown function, each question must be completed within 20s, otherwise 0 points and start the next question
* Added History feature , users do question the achievements recorded and can demonstrate a history
### 3.2 thought process
subject there are several difficulties:
* generate different expressions ** **
* solving the expression
* set of command line parameters
* GUI , countdown and history
#### 3.2.1 generated expression
needs to generate random numbers, random operators, random brackets, but also to ensure the correctness and uniqueness of expression.
#### 3.2.2 solving the expressions
solving integer expression of the original expressions into Reverse Polish Notation, then with a stack priority rule action can be. The problem is that the processing of proper fraction.
#### 3.2.3 graphical interface, countdown, history
graphical interface being considered implemented qt; countdown need multi-thread; history or write files, or connect to the database, when plenty of time to see it or not.
4. The design and implementation process ##
### 4.1 Description class module
#### 4.1.1 Num class
attributes:
* // whether the proper fraction isProperFraction BOOL type
* int numerator // molecule
* int denominator // denominator 

Method:
* friend function operator overloading, arithmetic
* random operation example

#### 4.1.2 ExpressionBuilder class
attributes:
* int NUM; // generated task number
* enum powerMark; // Flag exponentiation

Methods: 
* GenerateExp () // a given number of topics, generating the expression
* BuildExp () // generate a question
* PrintExp () // generated questions written to the file
* instantiated

#### 4.1.3 Expression class
attributes:
* expression The String; // expression printable
* Depending on the algorithm for solving a given data structure (stack) necessary for expression
* Num ans; // answers

Methods:
* the Solve () // evaluate expressions
* Check () // Check the answers right and wrong

#### 4.1.4 Main
parse the input parameters, call other classes, interact with the user

4.2 ### program execution flowchart
`` `Mermaid
flowchat
ST => Start: Start
e => end: End
main => Operation: main ()
C => for condition Condition: whether the input valid
ExpressionBuilder.Generate => operation: generating an expression formula
user => operation: user interaction
ExpressionBuilder.Check => operation: judging right or wrong answers (Lazy mode)
Output => inputOutput: error
ST-> Main-> C
C (Yes) -> ExpressionBuilder.Generate-> User-> the ExpressionBuilder .Check-> E
C (NO) -> output-> E
`` `

The test unit ##
* unit test is designed as follows
    1. Input test
    valid input and the main test procedures illegal input situation.
    
No | input format | expected output
-------- | ------- | -------
. 1 | Simple Mode + max_num | integer arithmetic formula
2 | middle mode + max_num | fraction, integer operations
3 | hard mode + max_num | fractional integer exponentiation of formula


2. Enter Test
detected four arithmetic operation in each of the correctness of the operator
ID | operand 1 | operand 2 | Operator | predictor
-------- | ------- | ------- | -------- | -------
1 | 2 | 1/2 | + | 5/2
2 | 2 | 1/2 | - | 3/2
. 3 | 2 |] 3/2 | * |. 3
. 4 | 2 | 1/2 | / |. 4
. 5 |. 3 |. 3 | ^ | 27
. 6 |. 3 | 0 | ^ |. 1
. 7 | 1/2 |. 1 | ^ | 1/2

3. Topic re-check test
number | Equation 1 | equation 2 | prediction
-------- | ------- | ------ | -------
1 | 2 + 3 + 4 | 4+ (2 + 3) | repeat
2 | 1 + 2 + 3 | 3 + 2 + 1 | Unique
3 | 2 * 3 | 3 * 2 | repeated
4 | (1 + 2) * 3 | 3 * (1 + 2) | Unique
5 | (1 + 2) * (3 + 4) | (3 + 4) * (1 + 2) | Unique
6 | (2-1) / (5- 3) | (5-3) / ( 2-1) | Unique
7 | (3 + 6) / (5-3) | (6 + 3) / (5-3) | repeated
8 | (1/2 +2/3) +3/4 | 1/2 + (2/3 + 3/4) | repeated
9 | (1/2 + 2 /3) * 3/4 | 3/4 * (1/2 + 2/3) | repeat

Released five original articles · won praise 3 · Views 2669

Guess you like

Origin blog.csdn.net/SaltyFishLu/article/details/104032365