Saturday, 30 July 2011

ATM DEMO


//*********************************************************************************
//
//                           Project Name :: ATM DEMO PROG.
//
//*********************************************************************************

#include<graphics.h>       
#include<dos.h>            
#include<conio.h>         
#include<stdio.h>
#include<stdlib.h>    
int count=0,number=0;
void welcomenote();    
void layout();        
void getpin();        
void buttonpress();  
void transaction();  
void main()
{      int  gd=DETECT,gm;
       initgraph(&gd,&gm,"c:\\tc\\bgi");  
       settextstyle(8,0,1);
       printf("\n\n\n\n\n\n\n\n                              ");
       layout();
       welcomenote();
       getpin();
      while(count<5)            
      {  delay(1000);
 buttonpress();
 printf("*");
count++;
      }
      delay(500);
      transaction();
      cleardevice();          
      layout();
      delay(500);
      setcolor(2);
      outtextxy(220,60,"BYE BYE");        
      delay(500);
      setcolor(1);
      outtextxy(210,100,"HAVE A NICE" );
      delay(500);
      setcolor(1);
      outtextxy(240,140,"DAY");
      setcolor(BLACK);
      outtextxy(50,400,"DEVELOPED BY:- ASHUTOSH  SINGH");
      setcolor(6);
      outtextxy(50,400,"PRESS ENTER TO EXIT");

     getch();
}
void welcomenote()
{    delay(2000);
     setcolor(2);
     outtextxy(220,70,"WELCOME"); delay(500);
     outtextxy(250,110,"TO");     delay(500);
     outtextxy(200,150,"ATM MACHINE");delay(500);
}
void layout()
{    setcolor(2);
     rectangle(0,0,635,475);       // BOUNDRY
     setcolor(5);
     rectangle(3,3,632,472);
     setcolor(6);
     rectangle(170,30,500,350);    // BODY
     line(390,30,390,350);
     line(390,130,500,130);
     line(390,240,500,240);
     rectangle(195,50,345,210);   //SCREEN
     rectangle(193,48,347,212);
     rectangle(225,220,315,340); // BUTTON PAD
     rectangle(230,225,250,245); // BUTTON 1
     outtextxy(235,220,"1");
     rectangle(260,225,280,245); // BUTTON 2
     outtextxy(265,220,"2");
     rectangle(290,225,310,245); // BUTTON 3
     outtextxy(295,220,"3");
     rectangle(230,255,250,275); // BUTTON 4
     outtextxy(235,250,"4");
     rectangle(260,255,280,275); // BUTTON 5
     outtextxy(265,250,"5");
     rectangle(290,255,310,275); // BUTTON 6
     outtextxy(295,250,"6");
     rectangle(230,285,250,305); // BUTTON 7
     outtextxy(235,280,"7");
     rectangle(260,285,280,305); // BUTTON 8
     outtextxy(265,280,"8");
     rectangle(290,285,310,305); // BUTTON 9
     outtextxy(295,280,"9");
     rectangle(260,315,280,335); // BUTTON 0
     outtextxy(265,310,"0");
     rectangle(410,100,460,110);  // RECEIPT BOX
     outtextxy(400,40,"RECEIPT");
     rectangle(410,190,460,200);  // INSERT CARD BOX
     circle(480,195,5);
     outtextxy(400,130,"ATM CARD");
     outtextxy(410,160,"HERE");
     rectangle(400,300,480,310);  // MONEY COLLECT
     outtextxy(410,260,"CASH");
     outtextxy(50,400,"DEVELOPED BY:- ASHUTOSH  SINGH");
}
void getpin()
{     setcolor(BLACK);
      outtextxy(220,70,"WELCOME"); delay(500);
      outtextxy(250,110,"TO");     delay(500);
      outtextxy(200,150,"ATM MACHINE");delay(500);
      setcolor(2);
      outtextxy(220,70,"ENTER PIN");
      rectangle(230,120,290,150);
}
void buttonpress()
{        delay(1000);
randomize();
number=1+random(10);  // GETTING RANDOM BUTTON

if(number==1)
{  setcolor(5);
   rectangle(230,225,250,245);
   outtextxy(235,220,"1");
   delay(200);
   setcolor(6);
   rectangle(230,225,250,245);
   outtextxy(235,220,"1");
   delay(200);
}
else if(number==2)
{  setcolor(5);
   rectangle(260,225,280,245);
   outtextxy(265,220,"2");
   delay(200);
   setcolor(6);
   rectangle(260,225,280,245);
   outtextxy(265,220,"2");
   delay(200);
}
else if(number==3)
{  setcolor(5);
   rectangle(290,225,310,245);
   outtextxy(295,220,"3");
   delay(200);
   setcolor(6);
   rectangle(290,225,310,245);
   outtextxy(295,220,"3");
   delay(200);
}
else if(number==4)
{  setcolor(5);
   rectangle(230,255,250,275);
   outtextxy(235,250,"4");
   delay(200);
   setcolor(6);
   rectangle(230,255,250,275);
   outtextxy(235,250,"4");
   delay(200);
}
else if(number==5)
{  setcolor(5);
   rectangle(260,255,280,275);
   outtextxy(265,250,"5");
   delay(200);
   setcolor(6);
   rectangle(260,255,280,275);
   outtextxy(265,250,"5");
   delay(200);
}
else if(number==6)
{   setcolor(5);
   rectangle(290,255,310,275);
   outtextxy(295,250,"6");
   delay(200);
   setcolor(6);
   rectangle(290,255,310,275);
   outtextxy(295,250,"6");
   delay(200);
}
else if(number==7)
{   setcolor(5);
   rectangle(230,285,250,305);
   outtextxy(235,280,"7");
   delay(200);
   setcolor(6);
   rectangle(230,285,250,305);
   outtextxy(235,280,"7");
   delay(200);
}
else if(number==8)
{  setcolor(5);
   rectangle(260,285,280,305);
   outtextxy(265,280,"8");
   delay(200);
   setcolor(6);
   rectangle(260,285,280,305);
   outtextxy(265,280,"8");
   delay(200);
}
else if(number==9)
 { setcolor(5);
   rectangle(290,285,310,305);
   outtextxy(295,280,"9");
   delay(200);
   setcolor(6);
   rectangle(290,285,310,305);
   outtextxy(295,280,"9");
   delay(200);
 }
else if(number==10)
 { setcolor(5);
   rectangle(260,315,280,335);
   outtextxy(265,310,"0");
   delay(200);
   setcolor(6);
   rectangle(260,315,280,335);
   outtextxy(265,310,"0");
   delay(200);
 }
    delay(500);
}
void transaction()
{   int wait2=0;
    clrscr();
    printf("\n\n\n\n\n\n                              ");
    cleardevice();
    layout();
    randomize();
    setcolor(1+random(14));
    outtextxy(200,70,"TRANSACTION?");
    setcolor(1+random(14));
    outtextxy(200,110,"1.BALANCE");
    setcolor(1+random(14));
    outtextxy(200,150,"2.WITHDRAW ");
    outtextxy(220,170,"CASH");
    delay(2000);
    int choice=1+random(2);
    int wait=0;
   while(wait<4)
   {
    if(choice==1)                   // CHOICE OF BALANCE
    {  setcolor(BLACK);
       outtextxy(200,110,"1.BALANCE");
       delay(500);
       setcolor(1+random(14));
       outtextxy(200,110,"1.BALANCE");
       delay(500);
    }
    else                             // CHOICE OF CASH WITHDRAW
    {  setcolor(BLACK);
       outtextxy(200,150,"2.WITHDRAW ");
       outtextxy(220,170,"CASH");
       delay(500);
       setcolor(1+random(14));
       outtextxy(200,150,"2.WITHDRAW ");
       outtextxy(220,170,"CASH");
       delay(500);
    }
       wait++;
  }
  cleardevice();
  layout();
  if(choice==1)                        // DISPLAYING BALANCE SUM
  { outtextxy(200,70," Rs. 54670");
    setcolor(2);
    outtextxy(200,110,"WOULD YOU ");
    outtextxy(200,140,"WANT RECEIPT");
    setcolor(8);
    delay(1000);
    outtextxy(200,180,"YES");
    outtextxy(290,180,"NO");
    int choice2=1+random(2);
    if(choice2==1)                   // CHOICE OF RECEIPT
    {     while(wait2<3)
{
 setcolor(BLACK);
 outtextxy(200,180,"YES");
 delay(200);
 setcolor(8);
 outtextxy(200,180,"YES");
 delay(200);
 wait2++;
}
wait2=0;
while(wait2<3)
{   setcolor(BLACK);
    rectangle(410,100,460,110);  // RECEIPT BOX
    outtextxy(400,40,"RECEIPT");
    delay(500);
    setcolor(2);
    rectangle(410,100,460,110);  // RECEIPT BOX
    outtextxy(400,40,"RECEIPT");
    delay(1000);
    wait2++;
}
     }
     else
     {   while(wait2<3)
{
 setcolor(BLACK);
 outtextxy(290,180,"NO");
 delay(200);
 setcolor(8);
 outtextxy(290,180,"NO");
 delay(200);
 wait2++;
}
     }
  }
  else
  { outtextxy(220,60,"ENTER SUM");      // GETTING SUM TO WITHDRAW
     rectangle(230,90,290,115);
     wait2=0;
     while(wait2<4)
     {   delay(1000);
 buttonpress();
 printf("*");
wait2++;
     }
     outtextxy(230,140,"RECEIPT ?");
     outtextxy(200,180,"YES");
     outtextxy(290,180,"NO");
     int choice2=1+random(2);
     wait2=0;
     if(choice2==1)
    {     while(wait2<3)
{
 setcolor(BLACK);
 outtextxy(200,180,"YES");
 delay(200);
 setcolor(8);
 outtextxy(200,180,"YES");
 delay(200);
 wait2++;
}
wait2=0;
while(wait2<3)
{   setcolor(BLACK);
    rectangle(410,100,460,110);  // RECEIPT BOX
    outtextxy(400,40,"RECEIPT");
    delay(500);
    setcolor(2);
    rectangle(410,100,460,110);  // RECEIPT BOX
    outtextxy(400,40,"RECEIPT");
    delay(500);
    wait2++;
}
     }
     else
     {   while(wait2<3)
{
 setcolor(BLACK);
 outtextxy(290,180,"NO");
 delay(200);
 setcolor(8);
 outtextxy(290,180,"NO");
 delay(200);
 wait2++;
}
     }
     cleardevice();
     layout();
     setcolor(2);
      delay(500);
     outtextxy(220,60,"PLEASE ");
     delay(500);
     outtextxy(220,90,"COLLECT");
      delay(500);
     outtextxy(220,120," CASH");
     wait=0;
     while(wait<4)
     {  setcolor(BLACK);
rectangle(400,300,480,310);  // MONEY COLLECT
outtextxy(410,260,"CASH");
delay(500);
setcolor(3);
rectangle(400,300,480,310);  // MONEY COLLECT
outtextxy(410,260,"CASH");
delay(500);
wait++;
     }
  }
}

No comments:

Post a Comment