• White Hat
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
public class CALCI
{
    public Integer a { get; set; }
    public Integer b { get; set; }
    public Integer r { get; set; }
    public string o { get; set; }
    
     public pageReference subb()
    {
         r = a - b;
        o='substraction';
        return null;
    }
     public pageReference add()
    {
         r = a + b;
        o='addition';
        return null;
    }
     public pageReference mul()
    {
         r = a * b;
        o='multiplication';
        return null;
    }    
}

--------------------------------------------------------------------------------------------------
<apex:page controller="CALCI" >
    <apex:form>
        <apex:pageBlock title="CALCI">
            <apex:pageBlockSection columns="1" title="simple operations" collapsible="false">
                <apex:pageBlockSectionItem>
                    <apex:outputLabel>Enter A</apex:outputLabel>
                    <apex:inputText value="{!a}"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem>
                    <apex:outputLabel>Enter B</apex:outputLabel>
                    <apex:inputText value="{!b}"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem>
                    <apex:outputLabel>you have performed {!o } of {!a} and {!b} and result is {!result}</apex:outputLabel>
                </apex:pageBlockSectionItem>               
            </apex:pageBlockSection>    
        </apex:pageBlock>
    </apex:form> 
</apex:page>