Monday, July 23, 2018

ATM TRANSACTION


       JAYA ENGINEERING COLLEGE
MENTOR : SAM
                 (JAYA ENGINEERING COLLEGE)
PROJECT DONE BY

#include <stdio.h>
long amount=20000,deposit,withdraw,user_no[10],person=20000; int choice, pin, k,transfier;
char transaction ='y',name[25];
int main()
  {
    while (pin != 1108)
    {
  printf("ENTER YOUR SECRET PIN NUMBER:");
    scanf("%d", &pin);
 
     if (pin != 1108)
        {
    printf("PLEASE ENTER VALID PASSWORD\n");
     }
  }
  do
  {
  printf("********Welcome to ATM Service**************\n");
printf("1. Check Balance\n"); printf("2. Withdraw Cash\n"); printf("3. Deposit Cash\n"); printf("4. Transfier Cash\n");
printf("5. Exit\n");
printf("******************?**************************?*\n\n"); printf("Enter your choice: "); scanf("%d", &choice);
   switch (choice)
    {
    case 1:
   printf("\n YOUR BALANCE IN Rs : %ld ", amount);
     break;
    case 2:
     printf("\n ENTER THE AMOUNT TO WITHDRAW: ");
    scanf("%ld", &withdraw);
   if (withdraw % 100 != 0)
    {
printf("\n PLEASE ENTER THE AMOUNT IN MULTIPLES OF 100");
      }
     else if (withdraw >(amount - 500))
{
  printf("\n INSUFFICENT BALANCE");
}
  else
{
    amount = amount - withdraw; printf("\n\n PLEASE COLLECT CASH"); printf("\n YOUR CURRENT BALANCE IS  %ld", amount);
    }
    break;
   case 3:
     printf("\n ENTER THE AMOUNT TO DEPOSIT  ");
    scanf("%ld", &deposit);
      amount = amount + deposit; printf("YOUR BALANCE IS %ld", amount);
    break;
    case 4:
      printf("\n\nEnter the person name:");
    scanf("%s",name);
    printf("\nEnter the %s's account no:",name);
    scanf("%d",&user_no);
    printf("\n\nHow much you want to transfier : ");
    scanf("%d",&transfier);
    if(transfier%100!=0)
    {
        printf("\nPlease enter the amount in multiples of 100");
    }
    else if(transfier>(amount-500))
    {
        printf("\n Insufficient Balance");
    }
    else
    {
        amount=amount-transfier;
        person=person+transfier;
        printf("\n\nRs %d is successfull transfierd\n to %s account",transfier,name);
        printf("\n\n%s current balance is :%d",name,person);
        printf("\n\nyour current balance is :%d",amount);
    }
    case 5:
    printf("\n THANK U USING ATM");
      break;
  default:
  printf("\n INVALID CHOICE");
   }
   printf("\n\n\n DO U WISH TO HAVE ANOTHER TRANSCATION?(y/n): \n");

   scanf("%s",&transaction);
  if (transaction == 'n'||transaction== 'N')
    k = 1;
   } while (!k);
        {
    printf("\n\n THANKS FOR USING ATM SERVICE");
            }

    }

No comments:

Post a Comment