Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
PAGE 1
Acknowledgement
PAGE 2
Contents
Page
Preface 1
Acknowledgement 2
Introduction 4
Objective 5
Function Implemented 6
Coding 7-17
Output Screenshots 18-20
Variable description 21
Use of different Methods
Conclusion
Bibliography
PAGE 3
Introduction
PAGE 4
Objective
The real objective behind this project is to give us an practical
experience on programming and developing with JAVA.
Our project was very simple and it was based on ATM and
here we were directed to code and develop a very simple user
interface of ATM using JAVA which is seen , experienced and
used by most of us in the bank ATMs. The main objective
behind this project was not only to gain marks in this subject
but also to enhance our knowledge of programing with JAVA.
While doing this project we learnt the use of various new
methods, escape sequences, new techniques and many thing.
It gave me a real-life experience on how to deal with various
kind of errors and how to make a system user-friendly. I think
in future it’d be really this experience would be really helpful
to me.
PAGE 5
Function Implemented
This program for ATM developed using JAVA can perfom all
task which a real Bank ATM can. Using this program the user
can:--
1. Create a new account
2. Withdraw Money
3. Deposit Money
4. Send Money To Any Other User
5. Change his/her Pin
6. Check his/her Balance
The aim of the code is to create a very simple interface for the
user which everyone could use even without the much
knowledge of technology. Here the Math.random() function
was also used to generate a random unique pin(4-digit) and a
unique account no.(10-digit) for the user every he/she creates
a account. Various kind of error handlings for various kind of
wrong inputs were added here so that the user can
understand his mistake(say a wrong pin input) and use this
system without any problem and at the same time the
complete security of this system maintained. So that no 2nd
person can any how get the details of the account of a user
and use his/her account. If the users enters a wrong pin to
maintain security on thing is added here which’d allow the
user to try again with the correct pin only for three times.
PAGE 6
Coding
import java.util.Scanner;
class atm_project
int pin,re_pin,balance,d_ac_check,temp,trial,temp_2;
atm_project() //constructor
return;
else
user_name=sc.nextLine();
user_add=sc.nextLine();
System.out.println("Enter the first amount you want to deposit (min Rs 1000) :");
balance=sc.nextInt();
PAGE 7
for(int i=0; i<=300;)
{ if(balance >=1000) // in case the deposit amount is less than Rs. 1000(error handling)
break;
else
System.out.println("Again enter the first amount you want to deposit (min Rs 1000) :");
balance=sc.nextInt();
System.out.println();
System.out.println("-----------------------------------------Account details------------------------------------------------
----");
System.out.println("Address : "+user_add);
System.out.println("PIN No : "+pin);
System.out.println("Balance : "+balance);
ac_check=1; //changing ac_check to 1 as one account is created (this variable is later used to check
whether a account is created or not)
{ trial=3;
{ System.out.println("-----------------------------------------Withdraw Money-------------------------------------------
---------");
PAGE 8
System.out.println("Welcome "+user_name);
for(int i=1;i<=300;)
System.out.println();
temp=sc.nextInt();
if(temp==pin)
temp=sc.nextInt();
balance=balance-temp;
return;
else
{ System.out.println("Insufficient Balance");
return ;
else
if(trial == 0) //only 3 chances to re_enter the pin in case wrong pin is entered
{System.out.println("You have entered the pin wrong four times no trials left");
return;
PAGE 9
System.out.println("Wrong pin entered");
System.out.println("Try again");
trial--;
else
return;
{ System.out.println("-----------------------------------------Deposit Money----------------------------------------------
------");
temp=sc.nextInt();
balance=balance+temp;
else
PAGE 10
{ trial=3; //it is the no. of times the user can try to enter the pin in case he enters a wrong pin
if(ac_check==1)
{ System.out.println("-----------------------------------------Money Transfer-----------------------------------------
-----------");
for(int i=1;i<=300;)
{ System.out.println("Welcome "+user_name);
temp=sc.nextInt();
if(temp==pin)
{ System.out.println("Enter the account details of the person you are sending money------");
temp_2=sc.nextInt();
int num=temp_2,count=0;
for(int j=0;j<=300;)
num=num/10;
count++;
if(count==10)
temp=sc.nextInt();
balance=balance-temp;
return;
PAGE 11
}
else
{ System.out.println("Insufficient Balance");
else
{ System.out.println("Wrong Input");
System.out.println("wait.... ");
return;
else
{ if(trial == 0)
{ System.out.println("You have entered the pin wrong four times no trials left");
return;
System.out.println("Try again");
trial--;
else
PAGE 12
{ System.out.println("No Account created !"); }
{ if(ac_check==1)
for(int i=1;i<=300;)
{ System.out.println();
temp=sc.nextInt();
if(temp == pin)
pin=sc.nextInt();
for(int j=0;j<=300;)
{int num=pin,digit_c=0;
while(num>0) //for checking whether the given pin is of four digit or not
{ num=num/10;
digit_c++;
if(digit_c==4)
{ break;
else
{ System.out.println("Enter only a four digit pin e.g 1234 :"); //in case it is more or less than 4-digit
} System.out.println("Re-enter it:");
re_pin=sc.nextInt();
PAGE 13
trial=3;
{ if(pin == re_pin)
break;
else
System.out.println("Wrongly Entered");
System.out.println("Enter it correctly:");
re_pin=sc.nextInt();
return;
else
if(trial == 0)
{ System.out.println("You have entered the wrong pin four times no trials left");
return;
System.out.println("Try again");
trial--;
else
PAGE 14
{ System.out.println("At first create a account");
{trial = 3;
if(ac_check==1)
{ for(int i=1;i<=300;)
{ System.out.println();
temp=sc.nextInt();
if(temp == pin)
return;
else
{ if(trial == 0)
{ System.out.println("You have entered the wrong pin four times no trials left");
return;
System.out.println("Try again");
PAGE 15
System.out.println("Re-enter your pin correctly :");
trial --;
}}}
else
for(int i=1;i<=300;)
{ System.out.println("-----------------------------------------ATM Menu---------------------------------------------------
-");
System.out.println();
System.out.println("7.Exit ");
int choice=kb.nextInt();
switch(choice)
{case 1:
ob.ac_create();
} break;
case 2:
PAGE 16
{ System.out.println("\u000C");//clearing the terminal window
ob.withdraw();
}break;
case 3:
ob.user_deposit();
} break;
case 4:
ob.send_money();
} break;
case 5:
ob.pin_change();
} break;
case 6:
ob.bal_check();
}break;
case 7:
System.out.println("Exiting....");
}break;
default:
}}}}}
PAGE 17
Output Screenshots
PAGE 18
PAGE 19
PAGE 20
Variable Description
Variable Name Data Type Use
user_name String For storing user name
PAGE 21
PAGE 22