0% found this document useful (0 votes)
180 views3 pages

Atm Code Apex

The document describes an ATM functionality implemented using Visualforce pages and Apex controllers in Salesforce. It includes an Apex class called Atm that handles the logic for validating the PIN and withdrawal amount. There are three Visualforce pages: atm1 displays a form to enter the PIN, atm2 displays a form to enter the withdrawal amount if the PIN is valid, and atm3 confirms the withdrawal amount. The Apex class methods pinpro() and amount() validate the input on the forms and navigate between the pages.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
180 views3 pages

Atm Code Apex

The document describes an ATM functionality implemented using Visualforce pages and Apex controllers in Salesforce. It includes an Apex class called Atm that handles the logic for validating the PIN and withdrawal amount. There are three Visualforce pages: atm1 displays a form to enter the PIN, atm2 displays a form to enter the withdrawal amount if the PIN is valid, and atm3 confirms the withdrawal amount. The Apex class methods pinpro() and amount() validate the input on the forms and navigate between the pages.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

ATM Functionality with code

Apex class

public class Atm {

public integer amount {set;get;}

public integer pin {set;get;}

Public pagereference pinpro()

if(pin>=1111 && pin<=9999)

pagereference pp=page.atm2;

return pp;

}else

apexpages.Message msg=new apexpages.Message(apexpages.Severity.ERROR,'insuffice found ');

Apexpages.addMessage(msg);

return null;

Public pagereference amount()

if(amount>0 && math.mod(amount, 100)==0)

pagereference p=page.atm3;

amount =amount;

return p;

}
else

Apexpages.Message ms=new Apexpages.Message(Apexpages.Severity.ERROR,'PLZ ENTER UR


CORRECT AMOUNT');

apexpages.addMessage(ms);

return null;

=========================================================================

vf page atm1.vf

<apex:page controller="Atm" >

<apex:pageMessages ></apex:pageMessages>

<apex:form >

<apex:pageBlock id="four" >

<apex:outputText value="ENTER PIN " ></apex:outputText>

<apex:inputSecret value="{!pin}" style="Color:red" />

<apex:commandButton value="Wtidra Amount" action="{!pinpro}" />

</apex:pageBlock>

</apex:form>

</apex:page>

=========================================================================

atm2.vf

<apex:page controller="atm" >


<apex:form>

<apex:pageMessages></apex:pageMessages>

<apex:pageBlock >

<apex:outputText value="ENTER AMOUNT " id="one" ></apex:outputText>

<apex:inputText value="{!amount}" />

<apex:commandButton value="YES" action="{!amount}" />

</apex:pageBlock>

</apex:form>

</apex:page>

=========================================================================

atm3.vf

<apex:page controller="atm" >

<marquee> WITHDRAD AMOUNT {!amount}</marquee>

<marquee> **THANKS ** </marquee>

</apex:page>

You might also like