Monday 23 January 2012

C code for ATM TRANSACTIONS........


/*Author-Neelkant.S.patil,GMIT,Davangere*/

 /*Note Pin code is 7890*/

#include<stdio.h>
#include<conio.h>
unsigned long amount=1000,deposit,withdraw;
int choice,pin,k;
char another='y';


void main()
{
textbackground(1);


while(pin!=7890)
{
clrscr();
gotoxy(30,25);
printf("ENTER PIN:");
scanf("%d",&pin);
if(pin!=7890)
printf("PLEASE ENTER VALID PASSWORD\n");


}
clrscr();
do
{
printf("********Welcome to ATM Service**************\n");
printf("1. Check Balance\n");
printf("2. Withdraw Cash\n");
printf("3. Deposit Cash\n");
printf("4. Quit\n");
printf("******************?**************************?*\n\n");
printf("Enter your choice: ");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("\nYOUR BALANCE IN Rs : %lu ",amount);
break;
case 2:
printf("\nENTER THE AMOUNT TO WITHDRAW: ");
scanf("%lu",&withdraw);
if(withdraw%100!=0)
{
printf("\nPLEASE ENTER THE AMOUNT IN MULTIPLES OF 100");
}
else if(withdraw>(amount-500))
{
printf("\nINSUFFICENT BALANCE");
}
else
{
amount=amount-withdraw;
printf("\n\nPLEASE COLLECT UR CASH");
printf("\nYOUR CURRENT BALANCE IS%lu",amount);
}
break;
case 3:
printf("\nENTER THE AMOUNT TO DEPOSIT");
scanf("%lu",&deposit);
amount=amount+deposit;
printf("YOUR BALANCE IS %lu",amount);
break;
case 4:
printf("\nTHANK U USING ATM");
break;
default:
printf("\nINVALID CHOICE");
}
printf("\n\n\nDO U WISH TO HAVE ANOTHER TRANSCATION?(y/n): ");
fflush(stdin);
scanf("%c",&another);
if(another=='n'||another=='N')
k=1;
}while(!k);
printf("\n\nTHANX FOR USING NEELKANT`s BANK");
getch();


}

1 comment:

  1. plzz make me same code with the following specifications
    TEST cases for ATM Machine

    1. Machine is accepting ATM card

    2. Machine is rejecting expired card

    3. Succesful entry of PIN number
    4. Unsuccessful operation due to wrong PIN number 3 times

    5. Succesful selection of language

    6. Successful selection of account type.

    7. Unsuccessful operation due to invalid account type

    8. Succesful selection of amount to be with draw

    9. Succesful withdraw

    10. Expected meggage due to amount is greater than day limit

    11. Unsuccesful withdraw operation due to lack of money in ATM

    12. Expected message due to amount to withdraw is greater than possible balance

    13. Unsuccessful withdraw operation due to click after insert card.
    and mail me to annusmartguy@gmail.com

    ReplyDelete