C program for hnb atm machine original - updated - [pys]

24
C Program for HNB ATM Machine DCSD 15.2 Group 5

Transcript of C program for hnb atm machine original - updated - [pys]

Page 1: C program for hnb atm machine   original - updated - [pys]

C Program for HNB ATM MachineDCSD 15.2Group 5

Page 2: C program for hnb atm machine   original - updated - [pys]

Introduction

•Mission: Building a C program to an ATM machine by using our C Programming Knowledge.

• Vision: Enhancing C programming know how in operating in ATM machines.

Page 3: C program for hnb atm machine   original - updated - [pys]

Background to the Project• Achieving the current issues and global issues. • Be practical in our day today world.• Co-op with the modern world.•Dealing with novel technical knowhow.• Enhancing team spirits and sharing knowledge.• Achieving the ultimate goals of our study area.

Page 4: C program for hnb atm machine   original - updated - [pys]

Aims & Objectives• Enhancing ICT know how in manipulating ATM

machines.• Awareness of progress of each and every component

given to the group.• Understanding the shortcoming or drawbacks and

taking remedial measures.• Proving the knowledge obtained practically.

Page 5: C program for hnb atm machine   original - updated - [pys]

• Getting students activity engaged in activities related ICT.

• Marking the learning outcomes positive & reach the ultimate goal.

• Understanding global issues. Cooperating up with current friends.

• Cooperating up with current friends.

Aims & Objectives

Page 6: C program for hnb atm machine   original - updated - [pys]

What is an ATM Machine?

An Automated Teller Machine (ATM) is an electronic banking outlet, which allows customers to complete basic transaction without the aid of a branch representative or a teller

Page 7: C program for hnb atm machine   original - updated - [pys]

ATM CardAn ATM card is any payment issued by a financial

institution that enables a customer to access an ATM machine in order to perform transaction.

Page 8: C program for hnb atm machine   original - updated - [pys]

Advantages• Can use ATM machines at any time without accessing into

a bank.• ATMs offer the convenience of multiple locations.• Your ATM card is protected by a PIN. • You don’t need to fill out any slips to do your task.• ATMs are faster than going to the bank – no long lines.• One can withdraw cash at ATMs in foreign countries.

Page 9: C program for hnb atm machine   original - updated - [pys]

Disadvantages• There must be system down failures.• You might forget your PIN number.• Risk of robbery when you leave the ATM.• Fees charge to use ATMs of other banks can become

expensive.

Page 10: C program for hnb atm machine   original - updated - [pys]

The Source Code

Page 11: C program for hnb atm machine   original - updated - [pys]

The first page

printf("\t\t\tEnter your PIN:"); scanf("%d",&pin); do{ if (pin==12345)

{ start(a); printf("\t\t\tSelect you operation: "); scanf("%d",&a); ; else { if (i<4) {printf("\t\tEnter valid PIN!\n");

Enter your pin:

Page 12: C program for hnb atm machine   original - updated - [pys]

do{ if (pin==12345)

{ start(a); printf("\t\t\tSelect your operation: "); scanf("%d",&a); } else { if (i<4) {printf("\t\tEnter valid PIN!\n");

return main();} else { printf("\n\n************* Your card has been blocked! ******************");

continue;} return 0;}

Calling the Start function

*******************your card has been blocked******************

Page 13: C program for hnb atm machine   original - updated - [pys]

void start(int a){ printf("*******************************************************************\n"); printf(" Welcome to HNB ATM service!\n"); printf("\n\n---------------------DCSD 15.2 GROUP 5-------------------------\n\n"); printf("*******************************************************************\n"); printf("\t\t\t1.Check amount.\n"); printf("\t\t\t2.Withdraw money.\n"); printf("\t\t\t3.Deposit money.\n"); printf("\t\t\t4.Transfer money.\n"); printf("\t\t\t5.Exit.\n"); printf("*******************************************************************\n");

The start function

Page 14: C program for hnb atm machine   original - updated - [pys]

************************************************************ Welcome to HNB ATM service!

-------------DCSD 15.2 GROUP 5---------------

************************************************************ 1.check the amount 2.withdraw money 3.Deposit money. 4.Transfer money. 5.Exit*************************************************************

Select your operation:

Page 15: C program for hnb atm machine   original - updated - [pys]

.....................

void print(){ int blink; printf("please wait....\n"); for(blink=0;blink<7;blink++) }

printf("...."); usleep(350000);}}

Special function

print

Please wait.........

Page 16: C program for hnb atm machine   original - updated - [pys]

void start(int a);void print();

float b=200000; int i=1;

Initial Balance

Declaring global variables

Page 17: C program for hnb atm machine   original - updated - [pys]

int main() { int a=0,pin=0; int acc_no=0; char m,M; float w=0,d=0,t=0; i=i+1;

Declaring the local variables

Page 18: C program for hnb atm machine   original - updated - [pys]

switch(a) { case 1: print();

printf("\n\tYour current balance is: Rs.%.2f",b); break; case 2: print(); printf("\n\tEnter amount:"); scanf("%f",&w); if(w<b&&b>500) {b=b-w; print(); printf("\n\t\t\t\tPlease collect your cash..!\n"); printf("\t\tCurrent balance is:Rs.%.2f",b);} else { printf("\n\t\t\t\tInsufficient balance!"); } break;

Your current balance is: Rs.200000.00 new operation ? (y/n):

Please wait.................................. Enter amount:100000Please wait................................ Please collect your cash..

Your current balance is: Rs. 100000.00 New operation ? (y/n)

Enter amount: 500000

Insufficient balance ! new operation ? (y/n):

Page 19: C program for hnb atm machine   original - updated - [pys]

case 3: print(); printf("\n\t\tEnter amount:"); scanf("%f",&d); {b=b+d; printf("\n\t\tYour current balance is: Rs.%.2f",b);} break;

Enter amount: 100000

Your current balance is :Rs.300000.00 new operation ? (y/n):

Page 20: C program for hnb atm machine   original - updated - [pys]

case 4: print(); printf("\n\t\tEnter Transfer Code:");scanf("%d",&acc_no); if(100000<acc_no&&acc_no<999999) { printf("\n\t\tEnter amount:"); scanf("%f",&t); if(t<b && b>500) { b=b-t; print(); printf("\n\t\t\tTransfer is successful!\n"); printf("\t\t\tYour current balance is: Rs.%.2f\n",b); } else { printf("\n\t\t\t\tInsufficient balance.!"); }

}

else { printf("\n\t\t\t\tInvalid Transfer Code! \n");}

break;

Enter the amount:

Enter recipient acc no:

...................100000

Your current balance is :Rs.100000.00

123456

Please wait.................

New opeeration ? (y/n):

Page 21: C program for hnb atm machine   original - updated - [pys]

case 5: print(); printf("\n\t\t\t\t\tThank you !\n"); return 0; default: printf("\n\t\t\t\tNo function!"); } printf("\n\t\tNew operation?(n/y):"); scanf("%s",&M); if (M=='n') break; }while (M=='y'); printf("\n\n\n\t\t\tThank you!\n"); printf("\n\t\t\t\tDo you want to exit?(y/n)"); scanf("%s",&m); if (m=='n') {

return main(1); } else if (m=='y') { return 0; } return 0; }

Page 22: C program for hnb atm machine   original - updated - [pys]
Page 23: C program for hnb atm machine   original - updated - [pys]

Group MembersGroup Members

M.K.P.U. Maddumage DG15230Suriyaarachchi P. Y DG15251N.V. Haththotuwa DG15216Ravindu M.H. S DG15246Prabhashwara.C.S. S DG15243I.K.L. Madushanka DG15233D.P.N. Senevirathna DG15250

Page 24: C program for hnb atm machine   original - updated - [pys]