function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Hiral Patel 25Hiral Patel 25 

write down visual force page11111

write down visual force page

                                    CALCULATOR

First Number ::  box
Second Number : :   box
Result:: box

Add     SUB    MUL  DIV
Everything in box and background color is gray Nd calcular color is  red
ANUTEJANUTEJ (Salesforce Developers) 
Hi HIral,

You can try the below implementation:
 
VisualforcePage

<apex:form >
   
    <apex:pageBlock >
        <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="Value 1"/>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:inputText value="{!val1}"/>
            </apex:pageBlockSectionItem>                          
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="Value 2"/>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:inputText value="{!val2}"/>
            </apex:pageBlockSectionItem>                         
            <apex:pageBlockSectionItem >
                <apex:selectRadio value="{!func}" layout="pageDirection">
                    <apex:selectOption itemValue="add" itemLabel="Add"/>
                    <apex:selectOption itemValue="sub" itemLabel="Subtract"/>
                    <apex:selectOption itemValue="div" itemLabel="Division"/>
                    <apex:selectOption itemValue="mod" itemLabel="Modulo Division"/>
                </apex:selectRadio>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >               
            </apex:pageBlockSectionItem>       
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="Result"/>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:inputText value="{!result}" id="res"/><apex:actionStatus id="sts" startText="Finding..."/>
            </apex:pageBlockSectionItem>                                      
        </apex:pageBlockSection>   
        <apex:pageBlockButtons >
            <apex:commandButton value="Find" action="{!find}" reRender="res"  status="sts"/>
        </apex:pageBlockButtons>
    </apex:pageBlock>
   
</apex:form>

</apex:page>

Apex Code:

public class Sample
{   
    public Double val1 {get;set;}
    public Double val2 {get;set;}
    public Double result {get;set;}
    public String func {get;set;}
   
    public Sample()
    {
    }
   
    public void find()
    {
        if(func == 'add')
        {
            result = val1 + val2;
        }
        else if(func == 'sub')
        {
             result = val1 - val2;
        }
        else if(func == 'div')
        {
             result = val1 / val2;
        }
        else
        {
             Integer temp =  math.mod(Integer.valueOf(val1) , Integer.valueOf(val2));
             result = Double.valueOf(temp);
        }
    }
  
}



reference: https://www.infallibletechie.com/2013/01/sample-caluculator-using-apex-in.html

I would also suggest you to checkout lightning implementation: https://www.biswajeetsamal.com/blog/simple-calculator-using-salesforce-lightning-components/

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.
Reddy RakeshReddy Rakesh
HI Patel,

<!-- vf page code-->
<apex:page controller="SampleCalculator" setup="false" sidebar="false" tabStyle="Lead" showHeader="True">
    <apex:sectionHeader title="Calculator" subtitle="Basic Calculator"/>
    <apex:form >
        <apex:pageMessages id="error" ></apex:pageMessages>
        <apex:pageBlock title="Sample calculator" >
            <apex:pageBlockButtons location="Bottom">
                <apex:commandButton value="Addition" action="{!addition}" reRender="res1,error,res" />
                <apex:commandButton value="subtraction" action="{!subtraction}" reRender="res1,error,res"/>
                    <apex:commandButton value="Divivsion" action="{!division}" reRender="res1,error,res"/>
                <apex:commandButton value="multiplication" action="{!multiplication}" reRender="res1,error,res"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Calculations" columns="1" collapsible="false">
                <apex:inputText label="Enter First Number" value="{!FirstNumber}" />
                <apex:inputtext label="Enter Second Number" value="{!SecondNumber}" />
                <apex:outputText id="res1" label="Result" value="{!result}"> </apex:outputText> 
                <apex:outputLabel id="res">Result : {!result} </apex:outputLabel>
            </apex:pageBlockSection>
        </apex:pageBlock>
    
    </apex:form>
</apex:page>



<!-- apex class-->
public class SampleCalculator 
{
Public integer firstNumber{get;set;}
public integer secondNumber{get;set;}
public Integer Result{get;set;}
public string a{get;set;}

public void addition()
{
    if(Firstnumber != 0 || secondNumber != 0)
    {
        Result= firstNumber + secondNumber;
        apexpages.addMessage(new ApexPages.message(apexpages.severity.Confirm,'Operation completed succsefully'));
     
    }
    else
    {
    apexpages.addMessage(new ApexPages.message(apexpages.severity.error,'Please Enter Valid Two Numbers')); 
  
    }
}
public void subtraction()
{
     if(Firstnumber != 0 || secondNumber != 0)
    {
    result=firstNumber-secondNumber;
    apexpages.addMessage(new ApexPages.message(apexpages.severity.Confirm,'Operation completed succsefully'));
    }
    else
    {
      apexpages.addMessage(new ApexPages.message(apexpages.severity.error,'Please Enter Valid Two Numbers')); 
    }
}
public void multiplication()
{
     if(Firstnumber != 0 || secondNumber != 0)
    {
    result=firstNumber*secondNumber;
    apexpages.addMessage(new ApexPages.message(apexpages.severity.Confirm,'Operation completed succsefully'));
}
else
    {
      apexpages.addMessage(new ApexPages.message(apexpages.severity.error,'Please Enter Valid Two Numbers')); 
    }
}
public void division()
    
    {
        if(secondNumber > 0 && FirstNumber !=0 )
        {
        result=firstNumber/secondNumber;
            apexpages.addMessage(new ApexPages.message(apexpages.severity.confirm,'Operation completed succsefully'));
        }
        else
        {
            apexpages.addMessage(new ApexPages.message(apexpages.severity.error,'Please Enter both numbers and second number should not be zero'));
        }
        
    }
}



 
Martha Simons 14Martha Simons 14
Protein Secondary Structure Prediction using Stochastic Blockmodels in Protein Structure Measurements
This paper describes the first complete model of protein synthesis that addresses a real-time genealogical model: a time-dependent and discrete biological process that is used for the automatic recognition of protein activities in tissues. The model consists of a biological neuron at a level, called protein level, where its activity is known and monitored by a biological model. A temporal model of protein activities is also presented as a model approach.
  1. https://www.curezone.org/blogs/c/fmp.asp?i=2438337
  2. https://www.curezone.org/blogs/c/fmp.asp?i=2438339
  3. https://s3.amazonaws.com/gs-geo-images/c906b141-fa6e-4ca4-9c26-afe81096af13.pdf
  4. https://s3.amazonaws.com/gs-geo-images/c769260e-d54f-4248-b873-1fdf311ecd5b.pdf
  5. https://s3.amazonaws.com/gs-geo-images/ee66df46-3aea-4984-830d-01fdc8cf874a.pdf (https://s3.amazonaws.com/gs-geo-images/c769260e-d54f-4248-b873-1fdf311ecd5b.pdf)
  6. https://pubhtml5.com/homepage/qvfw
  7. https://pubhtml5.com/homepage/tdiy
  8. https://www.bark.com/en/us/company/one/lD2dB/
  9. https://www.bark.com/en/us/company/paper-writing-service/ByMz4/
  10. https://archive.org/details/best-free-online-research-courses-800x-600
  11. https://archive.org/details/girl_20210316
  12. https://openlibrary.org/authors/OL9119707A/iCotoba
  13. https://openlibrary.org/authors/OL9119712A/NicBrown
  14. https://openlibrary.org/authors/OL9119713A/SamWinchester (http://We analyze the protein activity recognition process using the biological neuron as the model. The computational results indicate that by using the biological neuron as an automatic model, our system can effectively model the biological activity in the tissues. The process of bioinformatics can also be used to classify proteins.)
  15. https://openlibrary.org/authors/OL9119731A/Densmitt
We analyze the protein activity recognition process using the biological neuron as the model. The computational results indicate that by using the biological neuron as an automatic model, our system can effectively model the biological activity in the tissues. The process of bioinformatics can also be used to classify proteins.