i create a sample calculator by using custom controllers in visualforce page.but i want a calculator and that should be seen,operating and working style look like a calculator.how can i create by using controllers in visualforce?
<apex:page controller="BasicVisualforcePage1">
<apex:form >
Enter num1 : <apex:inputText value="{!num1}"/><br/>
Enter num2 : <apex:inputText value="{!num2}"/> <br/>
<apex:commandButton value="Add" action="{!myAdditionMethod}"/><t/>
<apex:commandButton value="Sub" action="{!mysubMethod}"/>
<apex:commandButton value="Mul" action="{!myMulMethod}"/>
<apex:commandButton value="DIV" action="{!myDIVMethod}"/>
<br/>
HERE YOUR OUTPUT is:<apex:outputText value="{!additionValue}"/>
</apex:form>
</apex:page>
Class :
public class BasicVisualforcePage1{
public integer num1{set;get;}
public integer num2{set;get;}
public integer additionValue{set;get;}
public void myAdditionMethod(){
additionValue = num1+num2;
}
public void mysubMethod(){
additionValue = num1-num2;
}
public void myMulMethod(){
additionValue = num1*num2;
}
public void myDIVMethod(){
additionValue = num1/num2;
}
}
thank you for reply.i already create a sample calculator by using same like your code.but i want work with more numbers not two numbers.thats why i am want to create like a online calculator.if suppose i click on number 1 that should be display in box 1 .i want to design the visualforce page same like above pic and along with arithmetic operations.
check this link: http://www.infallibletechie.com/2013/01/sample-caluculator-using-apex-in.html
please find out bellow code....
Class :
Thanks & Regrads
Gopal M.
http://sriramrajesh58.blogspot.in/2014/11/sample-calculator-using-salesforce-site.html