One: Introduction
At present, mobile phones can be said to be very high penetration of electronic equipment, because of its easy to carry, easy to use, affordable, and so on, now the mobile phone has begun to a certain extent to replace the call function of fixed telephone, as well as some of the original computer software functions. Mobile phone software has become rich with the development of mobile phones, today has appeared a lot of specialized in the production of mobile phone software companies, although the production of many games software, But there are a lot of supporting tools. Our work in this system is mainly to design the whole system and use the programming language to realize the whole system, so that the system can run the calculation function correctly.
Second: Demand analysis
State definition: Can satisfy the basic mathematical operation. The specific requirements are as follows:
1, just start the calculator when the status: Start Calculation Key Start button "on"
2. Clear 0: Calculate the state of the calculator at the start, or at any time type the clear 0 key. 2. An operand: The state of the evaluator when an operand is entered, such as the state after typing "2", at which time the operand is "2", or the status after "3", "8", and the operand is "38".
3. Result: The state of the calculator after typing the "=" key, such as the state of the calculator after typing "3+5=". In this state if you enter a number, the number entered will be the first operand, starting a new calculation.
4. An operand and a two-tuple symbol: The state of the evaluator after entering one of the operands and a key in the subtraction, such as the state of the calculator after entering "31x5=÷" or "a".
5. Operand two: Enter an operand, a subtraction symbol, and the state of the evaluator after another operand, such as the state of the evaluator after you type "30÷4" or "3+5=÷5" in turn.
6. Operand Two operation result: Enter an operand, a subtraction symbol, and another operand and then type the state of the root key evaluator.
7. Error: The state in which an illegal calculation is performed, such as the execution of a ÷0 calculation or a root calculation of a negative number. For example, after 6/0 the result of the calculation is "0 cannot do divisor".
Three: Source Address
Https://github.com/1733965469/calculator/tree/master
Four: module design
After running the program, the system starts to listen for the user's key input, each time the input system will determine the type of user input, is the number or operation symbol or clear, after the judgment is divided into different types such as numbers, symbols, basic operations and so on for further processing, according to the requirements of users to continue the next operation, Finally, the final result is calculated and displayed in the display area. Calculation module Detailed design system to complete the calculation function of the whole calculator, then the calculation module is the key module of the whole system. Without the calculation module system can not successfully complete the calculation, will not meet the requirements of users. Therefore, the design of the calculation module is also the focus of this system design. The system wants to be able to display the calculator on the screen to have the overall layout, in this module to complete the layout of the specific design, so that users can see the entire calculator screen. At the same time the system wants to complete the calculation function must deal with the user input, when the input module monitoring into the calculation module, the calculation module will be based on the corresponding method for further processing. This part mainly is the logic judgment of input, basically will realize the logic judgment through if else.
Run:
Five: Experimental Experience
Through this experiment, the knowledge of Android was further consolidated, but many problems were encountered in the experiment, which took a long time to solve.
Pair Experiment Report-android calculator design