# Android Calculator---ideas and calculator function comb (unfinished)

Source: Internet
Author: User

Number keys (1-9), 0 keys, positive and negative conversions, decimal point, square root take the reciprocal, CE, C, backspace, subtraction, equals

Number keys (1-9):

1. Press the string on the screen to add a numeric character
2. If the first digit is pressed after the operator, the screen is first emptied and then

Judgment: There is no operator in front, if pressed, before the other number

0 Keys:

1. Pressing the 0 key, as long as the screen is not 0, will add a 0 character after the string
2. When there is only one 0 o'clock on the screen, no matter how the press is a 0

Judging: Is not zero on the screen

Decimal point:

1. If the previous is a 0, press the decimal point, and then press the operator, the screen shows 0 (by operator colleague, the number of redundant parts removed, as equals)
2. After pressing, add a decimal character after the string
3. If there are already decimal points, you can no longer enter the decimal point until you press the operator or equal sign or CE or BACKSPACE to delete the decimal point and start entering the next number.

Judging: Whether the decimal point is pressed before, and when the operator is pressed, the point status should go back to the state that can be pressed

Positive and negative conversions:

1. If it is a number plus a decimal point, the decimal points do not disappear after positive or negative conversion
2. If there is only 0 on the screen, press this key without changing
3. If there is nothing on the screen other than the minus sign, press this key to precede the string with a minus sign

If there is a minus sign on the screen, remove the minus sign

Judgment: Press after as long as not only 0, all directly add the burden of the number can be, do not need to consider the first, so judging whether the screen is 0; whether the first character on the screen is a minus sign

Square:

1. A square operation of the preceding number is pressed.
2. The current face already has another subtraction, pressing after the square operation of the previous number to display the square result, and then press equals, to display the total result
3. When you press a number and a subtraction, and then press this key to display the square result of the first number, and then press equals, display the total result

Judge:

Prescribing

1. When pressed, the preceding number is

2. The current face already has another subtraction, press after the first number of the first operation to show the root result, and then press equals, only show the total results

3. When you press a number and a subtraction, and then press this key to display the root result of the first number, and then press equals, show the total result

Take the countdown:

1. When pressed, the last digit entered will be counted.

2. The current face already has another subtraction, after pressing the previous number to take the reciprocal operation to display the reciprocal result, and then press Equals, to show the total result

3. When you press a number and a subtraction, then press this key to display the countdown result of the first digit, and then press equals to display the total result

Ce:

1. The number of recently entered zeros is zeroed when pressed

No need to judge

C: Press All to zero, all back to the initial state

No need to judge

BACKSPACE: When pressed, the last character of the string on the screen will be erased.

No need to judge

Subtraction

1. When pressed, an operation is recorded, the first number on the screen is constant, and if the operator is pressed directly, the first number is the default zero
2. If the previous operation has already been done and is equal, then when the operator is pressed, the result of the last operation is used as the first number, and the result of the first operation is still displayed on the screen.
3. If there is a previous operation but not equal to, then when the operator is pressed, the result of the first operation is displayed on the screen and is used as the first digit of the next operation.

Judgment: 1. Need judge record operation mode; 2.

Equals:

1. If the number and operator are pressed before, the number on the screen is calculated as the second number, the result of the operation is displayed, and if you continue to equal, the second number is always the second number, and the operation
2. If you press a number or number and a decimal point, the number is equal to the original, and if the last character is 0 or a decimal point, it will be completely removed (loop)
3. Press the equals sign, then press the number key to start a new operation

Android Calculator---ideas and calculator function comb (unfinished)

Related Keywords:
Related Article

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.