Design
a standard calculator in android.
Description: The
following program is a standard calculator. This program operates and functions
like a standard calculator.
In this program we will insert buttons for all numbers
from 0 to 9 and operators such as +,-,*,/
.
The equal button will be having the main logic of
calculating answers in it and then display it in the text box or label as
specified.
The negative numbers can be entered too the logic is
written in –m button on click of which user can enter negative number eg. -2
,-1 etc.
Clear button will reset all the values in text box to
null.
Logic used are
Addition:
ans= a+b;
Subtraction :
ans = a-b;
Multiplication:
ans = a*b;
Division:
ans=a/b;
Comments
Post a Comment