Controller Code :-
public class Calculator { Public Integer Number1{get;set;} Public Integer Number2{get;set;} Public integer Result{get;set;} public PageReference Subtraction() { Result= Number1 - Number2; return null; } public PageReference Addition() { Result= Number1 + Number2; return null; } public PageReference Division() { Result= Number1 / Number2; return null; } public PageReference Multiplication() { Result= Number1 * Number2; return null; } }
Visualforce Page :-
<apex:page controller="Calculator"> <apex:form > <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton value="Add" action="{!Addition}" reRender="refresh"/> <apex:commandButton value="Sub" action="{!Subtraction}" reRender="refresh"/> <apex:commandButton value="Divide" action="{!Division}" reRender="refresh"/> <apex:commandButton value="Multiply" action="{!Multiplication}" reRender="refresh"/> </apex:pageBlockButtons> <apex:outputPanel id="refresh"> <apex:pageBlockSection columns="2"> <apex:outputLabel value="Number 1"/> <apex:inputText value="{!Number1}"/> <apex:outputLabel value="Number 2"/> <apex:inputText value="{!Number2}"/> <apex:outputLabel value="Result"/> <apex:inputText value="{!Result}"/> </apex:pageBlockSection> </apex:outputPanel> </apex:pageBlock> </apex:form> </apex:page>
OutPut Screen 1 :-
Thanks.
ReplyDeleteWelcome buddy
DeleteGangaur Realtech is a professionally managed organisation specializing in real estate services where integrated services are provided by professionals to its clients seeking increased value by owning, occupying or investing in real estate. online antiderivative calculator
ReplyDelete