0% found this document useful (0 votes)
201 views38 pages

Atm Simulator System

This document describes the implementation of an ATM simulator system using Java. It includes the following key points: 1. The system is implemented using Java programming language in the NetBeans IDE. It connects to a MySQL database for account information. 2. Classes are created for the login screen, deposit transaction, and connections to the database. 3. The login screen allows users to enter their card number and PIN. Successful login leads to the transaction screen. 4. The deposit transaction class implements the deposit user interface, validating the PIN and updating the account balance in the database.

Uploaded by

nihal mani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
201 views38 pages

Atm Simulator System

This document describes the implementation of an ATM simulator system using Java. It includes the following key points: 1. The system is implemented using Java programming language in the NetBeans IDE. It connects to a MySQL database for account information. 2. Classes are created for the login screen, deposit transaction, and connections to the database. 3. The login screen allows users to enter their card number and PIN. Successful login leads to the transaction screen. 4. The deposit transaction class implements the deposit user interface, validating the PIN and updating the account balance in the database.

Uploaded by

nihal mani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 38

1.

INTRODUCTON
Broadly defined, an ATM SIMULATOR is a set of processes, functions and information within an
BANKING system that define, develop, and maintain account database. An Automated Teller
Machine (ATM) is a safety-critical and real-time system that is highly complicated in design and
implementation. This paper presents the formal design, specification, and modeling of the ATM
system using a denotational mathematics known as Real-Time Process Algebra (RTPA). The
conceptual model of the ATM system is introduced as the initial requirements for the system.
The architectural model of the ATM system is created using RTPA architectural modeling
methodologies and refined by a set of Unified Data Models (UDMs), which share a generic
mathematical model of tuples. The static behaviors of the ATM system are specified and refined
by a set of Unified Process Models (UPMs) for the ATM transition processing and system
supporting processes. The dynamic behaviors of the ATM system are specified and refined by
process priority allocation, process deployment, and process dispatch models. Based on the
formal design models of the ATM system, code can be automatically generated using the RTPA
Code Generator (RTPA-CG), or be seamlessly transformed into programs by programmers. The
formal models of ATM may not only serve as a formal design paradigm of real-time software
systems, but also a test bench for the expressive power and modeling capability of exiting formal
methods in software engineering.

1
2. PREFACE
I have made this project file on the topic ATM simulator system. I have tried my best to sort
out all the relevant detail to the topic to be included in the project. While in the beginning I
have tried to give a general view about this project. My efforts and wholehearted co-
corporation of each and everyone has ended on a successful note. I express my sincere
gratitude to Dr. Rajkumar Bhatia who assisting me throughout the preparation of this
project. I thank him for providing me the reinforcement, confidence and most importantly
the track for the topic whenever I needed it.

2
3. ACKNOWLEDGEMENT
I would like to thank respected Dr. Rajkumar Bhatia for giving me such a wonderful opportunity to
expand my knowledge for my own branch and giving me guidelines to present a project report. It
helped me a lot to realize of what we study for. Secondly, I would like to thank my parents who
patiently helped me as I went through my work and helped to modify and eliminate some of the
irrelevant or un-necessary stuffs. Thirdly, I would like to thank my friends who helped me to make
my work more organized and well-stacked till the end. Next, I would thank Microsoft, Oracle,
Dolphin for developing such a wonderful tools like MS Word, NetBeans 6.1 IDE and MySQL 5.5
Database Server. It helped my work a lot to remain error-free. Last but clearly not the least, I would
thank The Almighty for giving me strength to complete my project report on time.

3
4. IMPLEMENTATION
I use java programming language to implement the system. I use the NetBeans IDE Version
6.1 Graph Editor Toolkit 1992-2004 Tom Sawyer Software, Oakland, California. All rights
reserved.
I work on Windows 10 Operating System.

System Specification

package asimulatorsystem;

import java.sql.*;

public class conn {


Connection c;
Statement s;
public conn(){
try{
Class.forName("com.mysql.jdbc.Driver");
c =DriverManager.getConnection("jdbc:mysql:///project2","root","");
s=c.createStatement();

}catch(Exception e){
System.out.println(e);
}
}

}
package asimulatorsystem;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.util.*;

public class Deposit extends JFrame implements ActionListener{

JTextField t1,t2;
JButton b1,b2,b3;

4
JLabel l1,l2,l3;

Deposit(){

setFont(new Font("System", Font.BOLD, 22));


Font f = getFont();
FontMetrics fm = getFontMetrics(f);
int x = fm.stringWidth("DEPOSIT");
int y = fm.stringWidth(" ");
int z = getWidth() - (5*x);
int w = z/y;
String pad ="";
//for (int i=0; i!=w; i++) pad +=" ";
pad = String.format("%"+w+"s", pad);
setTitle(pad+"DEPOSIT");

l1 = new JLabel("ENTER AMOUNT YOU WANT");


l1.setFont(new Font("System", Font.BOLD, 35));

l2 = new JLabel("TO DEPOSIT");


l2.setFont(new Font("System", Font.BOLD, 35));

l3 = new JLabel("Enter Pin");


l3.setFont(new Font("System", Font.BOLD, 14));

t1 = new JTextField();
t1.setFont(new Font("Raleway", Font.BOLD, 22));

t2 = new JTextField();
t2.setFont(new Font("Raleway", Font.BOLD, 14));

b1 = new JButton("DEPOSIT");
b1.setFont(new Font("System", Font.BOLD, 18));
b1.setBackground(Color.BLACK);
b1.setForeground(Color.WHITE);

b2 = new JButton("BACK");
b2.setFont(new Font("System", Font.BOLD, 18));
b2.setBackground(Color.BLACK);
b2.setForeground(Color.WHITE);

b3 = new JButton("EXIT");
b3.setFont(new Font("System", Font.BOLD, 18));
b3.setBackground(Color.BLACK);
b3.setForeground(Color.WHITE);

setLayout(null);

l3.setBounds(620,10,80,30);
add(l3);
5
t2.setBounds(700,10,40,30);
add(t2);

l1.setBounds(150,150,800,60);
add(l1);

l2.setBounds(290,210,800,60);
add(l2);

t1.setBounds(250,300,300,50);
add(t1);

b1.setBounds(260,380,125,50);
add(b1);

b2.setBounds(415,380,125,50);
add(b2);

b3.setBounds(300,550,200,50);
add(b3);

b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);

getContentPane().setBackground(Color.WHITE);

setSize(800,800);
setLocation(500,90);
setVisible(true);
}

public void actionPerformed(ActionEvent ae){

try{

String a = t1.getText();
String b = t2.getText();

if(ae.getSource()==b1){
if(t1.getText().equals("")){

JOptionPane.showMessageDialog(null, "Please enter the Amount to you want to


Deposit");

}else{

6
conn c1 = new conn();

ResultSet rs = c1.s.executeQuery(" select * from bank where pin = '"+b+"' ");

double balance = 0;
if(rs.next()){
String pin = rs.getString("pin");

balance = rs.getDouble("balance");

double d = Double.parseDouble(a);
balance+=d;
String q1= "insert into bank values('"+pin+"','"+d+"',null,'"+balance+"')";

c1.s.executeUpdate(q1);
}

JOptionPane.showMessageDialog(null, "Rs. "+a+" Deposited Successfully");

new Transcations().setVisible(true);
setVisible(false);

}else if(ae.getSource()==b2){

new Transcations().setVisible(true);
setVisible(false);

}else if(ae.getSource()==b3){

System.exit(0);

}
}catch(Exception e){
e.printStackTrace();
System.out.println("error: "+e);
}

public static void main(String[] args){


new Deposit().setVisible(true);
}

7
}
package asimulatorsystem;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;

public class Login extends JFrame implements ActionListener{


JLabel l1,l2,l3;
JTextField tf1;
JPasswordField pf2;
JButton b1,b2,b3;

Login(){

//Move the text to the center

setFont(new Font("System", Font.BOLD, 22));


Font f = getFont();
FontMetrics fm = getFontMetrics(f);
int x = fm.stringWidth("AUTOMATED TELLER MACHINE");
int y = fm.stringWidth(" ");
int z = getWidth() - x;
int w = z/y;
String pad ="";
//for (int i=0; i!=w; i++) pad +=" ";
pad = String.format("%"+w+"s", pad);
setTitle(pad+"AUTOMATED TELLER MACHINE");

l1 = new JLabel("WELCOME TO ATM");


l1.setFont(new Font("Osward", Font.BOLD, 38));

l2 = new JLabel("Card No:");


l2.setFont(new Font("Raleway", Font.BOLD, 28));

l3 = new JLabel("PIN:");
l3.setFont(new Font("Raleway", Font.BOLD, 28));

tf1 = new JTextField(15);


pf2 = new JPasswordField(15);

b1 = new JButton("SIGN IN");


b1.setBackground(Color.BLACK);
b1.setForeground(Color.WHITE);

8
b2 = new JButton("CLEAR");
b2.setBackground(Color.BLACK);
b2.setForeground(Color.WHITE);

b3 = new JButton("SIGN UP");


b3.setBackground(Color.BLACK);
b3.setForeground(Color.WHITE);

setLayout(null);

l1.setBounds(175,50,450,200);
add(l1);

l2.setBounds(125,150,375,200);
add(l2);

l3.setBounds(125,225,375,200);
add(l3);

tf1.setFont(new Font("Arial", Font.BOLD, 14));


tf1.setBounds(300,235,230,30);
add(tf1);

pf2.setFont(new Font("Arial", Font.BOLD, 14));


pf2.setBounds(300,310,230,30);
add(pf2);

b1.setFont(new Font("Arial", Font.BOLD, 14));


b1.setBounds(300,400,100,30);
add(b1);

b2.setFont(new Font("Arial", Font.BOLD, 14));


b2.setBounds(430,400,100,30);
add(b2);

b3.setFont(new Font("Arial", Font.BOLD, 14));


b3.setBounds(300,450,230,30);
add(b3);

b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);

getContentPane().setBackground(Color.WHITE);

setSize(750,750);
setLocation(500,200);
setVisible(true);

9
}
public void actionPerformed(ActionEvent ae){

try{
conn c1 = new conn();
String a = tf1.getText();
String b = pf2.getText();
String q = "select * from login where cardno = '"+a+"' and pin = '"+b+"'";
ResultSet rs = c1.s.executeQuery(q);

if(ae.getSource()==b1){
if(rs.next()){
new Transcations().setVisible(true);
setVisible(false);

}else{
JOptionPane.showMessageDialog(null, "Incorrect Card Number or Password");

}
}else if(ae.getSource()==b2){
tf1.setText("");
pf2.setText("");
}else if(ae.getSource()==b3){
new Signup().setVisible(true);
setVisible(false);
}
}catch(Exception e){
e.printStackTrace();
System.out.println("error: "+e);
}

public static void main(String[] args){


new Login().setVisible(true);
}

}
package asimulatorsystem;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Transcations extends JFrame implements ActionListener{

JLabel l1;
10
JButton b1,b2,b3,b4,b5,b6,b7;

Transcations(){

setFont(new Font("System", Font.BOLD, 22));


Font f = getFont();
FontMetrics fm = getFontMetrics(f);
int x = fm.stringWidth("TRANSACTION");
int y = fm.stringWidth(" ");
int z = getWidth() - (3*x);
int w = z/y;
String pad ="";
//for (int i=0; i!=w; i++) pad +=" ";
pad = String.format("%"+w+"s", pad);
setTitle(pad+"TRANSACTION");

l1 = new JLabel("Please Select Your Transaction");


l1.setFont(new Font("System", Font.BOLD, 38));

b1 = new JButton("DEPOSIT");
b1.setFont(new Font("System", Font.BOLD, 18));
b1.setBackground(Color.BLACK);
b1.setForeground(Color.WHITE);

b2 = new JButton("CASH WITHDRAWL");


b2.setFont(new Font("System", Font.BOLD, 18));
b2.setBackground(Color.BLACK);
b2.setForeground(Color.WHITE);

b3 = new JButton("FAST CASH");


b3.setFont(new Font("System", Font.BOLD, 18));
b3.setBackground(Color.BLACK);
b3.setForeground(Color.WHITE);

b4 = new JButton("MINI STATEMENT");


b4.setFont(new Font("System", Font.BOLD, 18));
b4.setBackground(Color.BLACK);
b4.setForeground(Color.WHITE);

b5 = new JButton("PIN CHANGE");


b5.setFont(new Font("System", Font.BOLD, 18));
b5.setBackground(Color.BLACK);
b5.setForeground(Color.WHITE);

b6 = new JButton("BALANCE ENQUIRY");


b6.setFont(new Font("System", Font.BOLD, 18));
b6.setBackground(Color.BLACK);
b6.setForeground(Color.WHITE);

b7 = new JButton("EXIT");
b7.setFont(new Font("System", Font.BOLD, 18));
11
b7.setBackground(Color.BLACK);
b7.setForeground(Color.WHITE);

setLayout(null);

l1.setBounds(100,100,700,40);
add(l1);

b1.setBounds(40,250,300,60);
add(b1);

b2.setBounds(440,250,300,60);
add(b2);

b3.setBounds(40,360,300,60);
add(b3);

b4.setBounds(440,360,300,60);
add(b4);

b5.setBounds(40,470,300,60);
add(b5);

b6.setBounds(440,470,300,60);
add(b6);

b7.setBounds(240,600,300,60);
add(b7);

b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
b6.addActionListener(this);
b7.addActionListener(this);

getContentPane().setBackground(Color.WHITE);

setSize(800,800);
setLocation(500,90);
setVisible(true);

public void actionPerformed(ActionEvent ae){

12
if(ae.getSource()==b1){

new Deposit().setVisible(true);
setVisible(false);

}
else if(ae.getSource()==b2){

new Withdrawl().setVisible(true);
setVisible(false);

}
else if(ae.getSource()==b3){

new FastCash().setVisible(true);
setVisible(false);

}else if(ae.getSource()==b4){

new Login().setVisible(true);
setVisible(false);

}else if(ae.getSource()==b5){

new Pin().setVisible(true);
setVisible(false);

}else if(ae.getSource()==b6){

String pinn = JOptionPane.showInputDialog("Enter PIN");


conn c1 = new conn();

try {

ResultSet rs = c1.s.executeQuery(" SELECT balance FROM bank ORDER BY pin = '"+pinn+"'


DESC LIMIT 1");

if(rs.next()){

String balance = rs.getString("balance");

JOptionPane.showMessageDialog(null,"Your Account Balance is "+balance);

} catch (Exception e) {

e.printStackTrace();

}
13
}else if(ae.getSource()==b7){

System.exit(0);

public static void main(String[] args){


new Transcations().setVisible(true);
}
}

package asimulatorsystem;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.util.*;

public class Signup extends JFrame implements ActionListener{

JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15;
JTextField t1,t2,t3,t4,t5,t6,t7;
JRadioButton r1,r2,r3,r4,r5;
JButton b;
JComboBox c1,c2,c3;

Random ran = new Random();


long first4 = (ran.nextLong() % 9000L) + 1000L;
long first = Math.abs(first4);

Signup(){

//Move the text to the center

setFont(new Font("System", Font.BOLD, 22));


Font f = getFont();
FontMetrics fm = getFontMetrics(f);
int x = fm.stringWidth("NEW ACCOUNT APPLICATION FORM");
14
int y = fm.stringWidth(" ");
int z = getWidth() - x;
int w = z/y;
String pad ="";
//for (int i=0; i!=w; i++) pad +=" ";
pad = String.format("%"+w+"s", pad);
setTitle(pad+"NEW ACCOUNT APPLICATION FORM");

l1 = new JLabel("APPLICATION FORM NO. "+first);


l1.setFont(new Font("Raleway", Font.BOLD, 38));

l2 = new JLabel("Page 1: Personal Details");


l2.setFont(new Font("Raleway", Font.BOLD, 22));

l3 = new JLabel("Name:");
l3.setFont(new Font("Raleway", Font.BOLD, 20));

l4 = new JLabel("Father's Name:");


l4.setFont(new Font("Raleway", Font.BOLD, 20));

l5 = new JLabel("Date of Birth:");


l5.setFont(new Font("Raleway", Font.BOLD, 20));

l6 = new JLabel("Gender:");
l6.setFont(new Font("Raleway", Font.BOLD, 20));

l7 = new JLabel("Email Address:");


l7.setFont(new Font("Raleway", Font.BOLD, 20));

l8 = new JLabel("Marital Status:");


l8.setFont(new Font("Raleway", Font.BOLD, 20));

l9 = new JLabel("Address:");
l9.setFont(new Font("Raleway", Font.BOLD, 20));

l10 = new JLabel("City:");


l10.setFont(new Font("Raleway", Font.BOLD, 20));

l11 = new JLabel("Pin Code:");


l11.setFont(new Font("Raleway", Font.BOLD, 20));

l12 = new JLabel("State:");


l12.setFont(new Font("Raleway", Font.BOLD, 20));

l13 = new JLabel("Date");


l13.setFont(new Font("Raleway", Font.BOLD, 14));

15
l14 = new JLabel("Month");
l14.setFont(new Font("Raleway", Font.BOLD, 14));

l15 = new JLabel("Year");


l15.setFont(new Font("Raleway", Font.BOLD, 14));

t1 = new JTextField();
t1.setFont(new Font("Raleway", Font.BOLD, 14));

t2 = new JTextField();
t2.setFont(new Font("Raleway", Font.BOLD, 14));

t3 = new JTextField();
t3.setFont(new Font("Raleway", Font.BOLD, 14));

t4 = new JTextField();
t4.setFont(new Font("Raleway", Font.BOLD, 14));

t5 = new JTextField();
t5.setFont(new Font("Raleway", Font.BOLD, 14));

t6 = new JTextField();
t6.setFont(new Font("Raleway", Font.BOLD, 14));

t7 = new JTextField();
t7.setFont(new Font("Raleway", Font.BOLD, 14));

b = new JButton("Next");
b.setFont(new Font("Raleway", Font.BOLD, 14));
b.setBackground(Color.BLACK);
b.setForeground(Color.WHITE);

r1 = new JRadioButton("Male");
r1.setFont(new Font("Raleway", Font.BOLD, 14));
r1.setBackground(Color.WHITE);

r2 = new JRadioButton("Female");
r2.setFont(new Font("Raleway", Font.BOLD, 14));
r2.setBackground(Color.WHITE);

r3 = new JRadioButton("Married");
r3.setFont(new Font("Raleway", Font.BOLD, 14));
r3.setBackground(Color.WHITE);

r4 = new JRadioButton("Unmarried");
r4.setFont(new Font("Raleway", Font.BOLD, 14));
r4.setBackground(Color.WHITE);

r5 = new JRadioButton("Other");
16
r5.setFont(new Font("Raleway", Font.BOLD, 14));
r5.setBackground(Color.WHITE);

String date[] = {"1","2","3","4","5","6","7","8","9"};


c1 = new JComboBox(date);
c1.setBackground(Color.WHITE);

String month[] =
{"January","February","March","April","May","June","July","August","September","October","Nove
mber","December"};
c2 = new JComboBox(month);
c2.setBackground(Color.WHITE);

String year[] =
{"1990","1991","1992","1993","1994","1995","1996","1997","1998","1999","2000","2001","2002"}
;
c3 = new JComboBox(year);
c3.setBackground(Color.WHITE);

setLayout(null);
l1.setBounds(140,20,600,40);
add(l1);

l2.setBounds(290,70,600,30);
add(l2);

l3.setBounds(100,140,100,30);
add(l3);

t1.setBounds(300,140,400,30);
add(t1);

l4.setBounds(100,190,200,30);
add(l4);

t2.setBounds(300,190,400,30);
add(t2);

l5.setBounds(100,240,200,30);
add(l5);

l13.setBounds(300,240,40,30);
add(l13);

c1.setBounds(340,240,60,30);
add(c1);

l14.setBounds(410,240,50,30);
17
add(l14);

c2.setBounds(460,240,100,30);
add(c2);

l15.setBounds(570,240,40,30);
add(l15);

c3.setBounds(610,240,90,30);
add(c3);

l6.setBounds(100,290,200,30);
add(l6);

r1.setBounds(300,290,60,30);
add(r1);

r2.setBounds(450,290,90,30);
add(r2);

l7.setBounds(100,340,200,30);
add(l7);

t3.setBounds(300,340,400,30);
add(t3);

l8.setBounds(100,390,200,30);
add(l8);

r3.setBounds(300,390,100,30);
add(r3);

r4.setBounds(450,390,100,30);
add(r4);

r5.setBounds(635,390,100,30);
add(r5);

l9.setBounds(100,440,200,30);
add(l9);

t4.setBounds(300,440,400,30);
add(t4);

l10.setBounds(100,490,200,30);
add(l10);

t5.setBounds(300,490,400,30);
add(t5);

18
l11.setBounds(100,540,200,30);
add(l11);

t6.setBounds(300,540,400,30);
add(t6);

l12.setBounds(100,590,200,30);
add(l12);

t7.setBounds(300,590,400,30);
add(t7);

b.setBounds(620,660,80,30);
add(b);

b.addActionListener(this);

getContentPane().setBackground(Color.WHITE);

setSize(850,850);
setLocation(500,90);
setVisible(true);
}

public void actionPerformed(ActionEvent ae){

String a = t1.getText();
String b = t2.getText();

String ac = (String)c1.getSelectedItem();
String bc = (String)c2.getSelectedItem();
String cc = (String)c3.getSelectedItem();

String d = null;
if(r1.isSelected()){
d = "Male";
}
else if(r2.isSelected()){
d = "Female";
}

String e = t3.getText();
String f = null;
if(r3.isSelected()){
f = "Married";
}else if(r4.isSelected()){
f = "Unmarried";
}else if(r5.isSelected()){
f = "Other";
}

19
String g = t4.getText();
String h = t5.getText();
String i = t6.getText();
String j = t7.getText();

try{

if(t6.getText().equals("")){
JOptionPane.showMessageDialog(null, "Fill all the required fields");
}else{

conn c1 = new conn();


String q1 = "insert into signup
values('"+a+"','"+b+"','"+ac+"','"+bc+"','"+cc+"','"+d+"','"+e+"','"+f+"','"+g+"','"+h+"','"+i+"','"+j+"','"+
first+"')";
c1.s.executeUpdate(q1);

new Signup2().setVisible(true);
setVisible(false);
}

}catch(Exception ex){
ex.printStackTrace();
}

public static void main(String[] args){


new Signup().setVisible(true);
}
}

package asimulatorsystem;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;

public class Signup2 extends JFrame implements ActionListener{

JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12;
JButton b;
JRadioButton r1,r2,r3,r4;
JTextField t1,t2,t3;
JComboBox c1,c2,c3,c4,c5;

20
Signup2(){

setFont(new Font("System", Font.BOLD, 22));


Font f = getFont();
FontMetrics fm = getFontMetrics(f);
int x = fm.stringWidth("NEW ACCOUNT APPLICATION FORM - PAGE 2");
int y = fm.stringWidth(" ");
int z = getWidth()/2 - (x/2);
int w = z/y;
String pad ="";
//for (int i=0; i!=w; i++) pad +=" ";
pad = String.format("%"+w+"s", pad);
setTitle(pad+"NEW ACCOUNT APPLICATION FORM - PAGE 2");

l1 = new JLabel("Page 2: Additonal Details");


l1.setFont(new Font("Raleway", Font.BOLD, 22));

l2 = new JLabel("Religion:");
l2.setFont(new Font("Raleway", Font.BOLD, 18));

l3 = new JLabel("Category:");
l3.setFont(new Font("Raleway", Font.BOLD, 18));

l4 = new JLabel("Income:");
l4.setFont(new Font("Raleway", Font.BOLD, 18));

l5 = new JLabel("Educational");
l5.setFont(new Font("Raleway", Font.BOLD, 18));

l11 = new JLabel("Qualification:");


l11.setFont(new Font("Raleway", Font.BOLD, 18));

l6 = new JLabel("Occupation:");
l6.setFont(new Font("Raleway", Font.BOLD, 18));

l7 = new JLabel("PAN Number:");


l7.setFont(new Font("Raleway", Font.BOLD, 18));

l8 = new JLabel("Aadhar Number:");


l8.setFont(new Font("Raleway", Font.BOLD, 18));

l9 = new JLabel("Senior Citizen:");


l9.setFont(new Font("Raleway", Font.BOLD, 18));

l10 = new JLabel("Existing Account:");


l10.setFont(new Font("Raleway", Font.BOLD, 18));

l12 = new JLabel("Form No:");


21
l12.setFont(new Font("Raleway", Font.BOLD, 13));

b = new JButton("Next");
b.setFont(new Font("Raleway", Font.BOLD, 14));
b.setBackground(Color.BLACK);
b.setForeground(Color.WHITE);

t1 = new JTextField();
t1.setFont(new Font("Raleway", Font.BOLD, 14));

t2 = new JTextField();
t2.setFont(new Font("Raleway", Font.BOLD, 14));

t3 = new JTextField();
t3.setFont(new Font("Raleway", Font.BOLD, 13));

r1 = new JRadioButton("Yes");
r1.setFont(new Font("Raleway", Font.BOLD, 14));
r1.setBackground(Color.WHITE);

r2 = new JRadioButton("No");
r2.setFont(new Font("Raleway", Font.BOLD, 14));
r2.setBackground(Color.WHITE);

r3 = new JRadioButton("Yes");
r3.setFont(new Font("Raleway", Font.BOLD, 14));
r3.setBackground(Color.WHITE);

r4 = new JRadioButton("No");
r4.setFont(new Font("Raleway", Font.BOLD, 14));
r4.setBackground(Color.WHITE);

String religion[] = {"Hindu","Muslim","Sikh","Christian","Other"};


c1 = new JComboBox(religion);
c1.setBackground(Color.WHITE);
c1.setFont(new Font("Raleway", Font.BOLD, 14));

String category[] = {"General","OBC","SC","ST","Other"};


c2 = new JComboBox(category);
c2.setBackground(Color.WHITE);
c2.setFont(new Font("Raleway", Font.BOLD, 14));

String income[] = {"Null","<1,50,000","<2,50,000","<5,00,000","Upto 10,00,000","Above


10,00,000"};
c3 = new JComboBox(income);
22
c3.setBackground(Color.WHITE);
c3.setFont(new Font("Raleway", Font.BOLD, 14));

String education[] = {"Non-Graduate","Graduate","Post-Graduate","Doctrate","Others"};


c4 = new JComboBox(education);
c4.setBackground(Color.WHITE);
c4.setFont(new Font("Raleway", Font.BOLD, 14));

String occupation[] = {"Salaried","Self-Employmed","Business","Student","Retired","Others"};


c5 = new JComboBox(occupation);
c5.setBackground(Color.WHITE);
c5.setFont(new Font("Raleway", Font.BOLD, 14));

setLayout(null);

l12.setBounds(700,10,60,30);
add(l12);

t3.setBounds(760,10,60,30);
add(t3);

l1.setBounds(280,30,600,40);
add(l1);

l2.setBounds(100,120,100,30);
add(l2);

c1.setBounds(350,120,320,30);
add(c1);

l3.setBounds(100,170,100,30);
add(l3);

c2.setBounds(350,170,320,30);
add(c2);

l4.setBounds(100,220,100,30);
add(l4);

c3.setBounds(350,220,320,30);
add(c3);

l5.setBounds(100,270,150,30);
add(l5);

c4.setBounds(350,270,320,30);
add(c4);

l11.setBounds(100,290,150,30);
add(l11);
23
l6.setBounds(100,340,150,30);
add(l6);

c5.setBounds(350,340,320,30);
add(c5);

l7.setBounds(100,390,150,30);
add(l7);

t1.setBounds(350,390,320,30);
add(t1);

l8.setBounds(100,440,180,30);
add(l8);

t2.setBounds(350,440,320,30);
add(t2);

l9.setBounds(100,490,150,30);
add(l9);

r1.setBounds(350,490,100,30);
add(r1);

r2.setBounds(460,490,100,30);
add(r2);

l10.setBounds(100,540,180,30);
add(l10);

r3.setBounds(350,540,100,30);
add(r3);

r4.setBounds(460,540,100,30);
add(r4);

b.setBounds(570,600,100,30);
add(b);

b.addActionListener(this);

getContentPane().setBackground(Color.WHITE);

setSize(850,850);
setLocation(500,90);
setVisible(true);
}

public void actionPerformed(ActionEvent ae){

24
String a = (String)c1.getSelectedItem();
String b = (String)c2.getSelectedItem();
String c = (String)c3.getSelectedItem();
String d = (String)c4.getSelectedItem();
String e = (String)c5.getSelectedItem();

String f = t1.getText();
String g = t2.getText();

String h = "";
if(r1.isSelected()){
h = "Yes";
}
else if(r2.isSelected()){
h = "No";
}

String i = "";
if(r3.isSelected()){
i = "Yes";
}else if(r4.isSelected()){
i = "No";
}

String j = t3.getText();

try{

if(t2.getText().equals("")){
JOptionPane.showMessageDialog(null, "Fill all the required fields");
}else{
conn c1 = new conn();
String q1 = "insert into signup2
values('"+a+"','"+b+"','"+c+"','"+d+"','"+e+"','"+f+"','"+g+"','"+h+"','"+i+"','"+j+"')";
c1.s.executeUpdate(q1);

new Signup3().setVisible(true);
setVisible(false);
}

}catch(Exception ex){
ex.printStackTrace();
}

25
public static void main(String[] args){
new Signup2().setVisible(true);
}
}
package asimulatorsystem;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.util.*;

public class Signup3 extends JFrame implements ActionListener{

JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11;
JRadioButton r1,r2,r3,r4;
JButton b1,b2;
JCheckBox c1,c2,c3,c4,c5,c6,c7;
JTextField t1;

Signup3(){

setFont(new Font("System", Font.BOLD, 22));


Font f = getFont();
FontMetrics fm = getFontMetrics(f);
int x = fm.stringWidth("NEW ACCOUNT APPLICATION FORM - PAGE 3");
int y = fm.stringWidth(" ");
int z = getWidth()/2 - (x/2);
int w = z/y;
String pad ="";
//for (int i=0; i!=w; i++) pad +=" ";
pad = String.format("%"+w+"s", pad);
setTitle(pad+"NEW ACCOUNT APPLICATION FORM - PAGE 3");

l1 = new JLabel("Page 3: Account Details");


l1.setFont(new Font("Raleway", Font.BOLD, 22));

l2 = new JLabel("Account Type:");


l2.setFont(new Font("Raleway", Font.BOLD, 18));

l3 = new JLabel("Card Number:");


l3.setFont(new Font("Raleway", Font.BOLD, 18));

l4 = new JLabel("XXXX-XXXX-XXXX-4184");
l4.setFont(new Font("Raleway", Font.BOLD, 18));

l5 = new JLabel("(Your 16-digit Card number)");


26
l5.setFont(new Font("Raleway", Font.BOLD, 12));

l6 = new JLabel("It would appear on ATM Card/Cheque Book and Statements");


l6.setFont(new Font("Raleway", Font.BOLD, 12));

l7 = new JLabel("PIN:");
l7.setFont(new Font("Raleway", Font.BOLD, 18));

l8 = new JLabel("XXXX");
l8.setFont(new Font("Raleway", Font.BOLD, 18));

l9 = new JLabel("(4-digit password)");


l9.setFont(new Font("Raleway", Font.BOLD, 12));

l10 = new JLabel("Services Required:");


l10.setFont(new Font("Raleway", Font.BOLD, 18));

l11 = new JLabel("Form No:");


l11.setFont(new Font("Raleway", Font.BOLD, 14));

b1 = new JButton("Submit");
b1.setFont(new Font("Raleway", Font.BOLD, 14));
b1.setBackground(Color.BLACK);
b1.setForeground(Color.WHITE);

b2 = new JButton("Cancel");
b2.setFont(new Font("Raleway", Font.BOLD, 14));
b2.setBackground(Color.BLACK);
b2.setForeground(Color.WHITE);

c1 = new JCheckBox("ATM CARD");


c1.setBackground(Color.WHITE);
c1.setFont(new Font("Raleway", Font.BOLD, 16));

c2 = new JCheckBox("Internet Banking");


c2.setBackground(Color.WHITE);
c2.setFont(new Font("Raleway", Font.BOLD, 16));

c3 = new JCheckBox("Mobile Banking");


c3.setBackground(Color.WHITE);
c3.setFont(new Font("Raleway", Font.BOLD, 16));

c4 = new JCheckBox("EMAIL Alerts");


c4.setBackground(Color.WHITE);
c4.setFont(new Font("Raleway", Font.BOLD, 16));

c5 = new JCheckBox("Cheque Book");


c5.setBackground(Color.WHITE);
c5.setFont(new Font("Raleway", Font.BOLD, 16));

27
c6 = new JCheckBox("E-Statement");
c6.setBackground(Color.WHITE);
c6.setFont(new Font("Raleway", Font.BOLD, 16));

c7 = new JCheckBox("I hereby declares that the above entered details correct to th best of my
knowledge.",true);
c7.setBackground(Color.WHITE);
c7.setFont(new Font("Raleway", Font.BOLD, 12));

r1 = new JRadioButton("Saving Account");


r1.setFont(new Font("Raleway", Font.BOLD, 16));
r1.setBackground(Color.WHITE);

r2 = new JRadioButton("Fixed Deposit Account");


r2.setFont(new Font("Raleway", Font.BOLD, 16));
r2.setBackground(Color.WHITE);

r3 = new JRadioButton("Current Account");


r3.setFont(new Font("Raleway", Font.BOLD, 16));
r3.setBackground(Color.WHITE);

r4 = new JRadioButton("Recurring Deposit Account");


r4.setFont(new Font("Raleway", Font.BOLD, 16));
r4.setBackground(Color.WHITE);

t1 = new JTextField();
t1.setFont(new Font("Raleway", Font.BOLD, 12));

setLayout(null);

l11.setBounds(700,10,70,30);
add(l11);

t1.setBounds(770,10,40,30);
add(t1);

l1.setBounds(280,50,400,40);
add(l1);

l2.setBounds(100,140,200,30);
add(l2);

r1.setBounds(100,180,150,30);
add(r1);

r2.setBounds(350,180,300,30);
add(r2);

28
r3.setBounds(100,220,250,30);
add(r3);

r4.setBounds(350,220,250,30);
add(r4);

l3.setBounds(100,300,200,30);
add(l3);

l4.setBounds(330,300,250,30);
add(l4);

l5.setBounds(100,330,200,20);
add(l5);

l6.setBounds(330,330,500,20);
add(l6);

l7.setBounds(100,370,200,30);
add(l7);

l8.setBounds(330,370,200,30);
add(l8);

l9.setBounds(100,400,200,20);
add(l9);

l10.setBounds(100,450,200,30);
add(l10);

c1.setBounds(100,500,200,30);
add(c1);

c2.setBounds(350,500,200,30);
add(c2);

c3.setBounds(100,550,200,30);
add(c3);

c4.setBounds(350,550,200,30);
add(c4);

c5.setBounds(100,600,200,30);
add(c5);

c6.setBounds(350,600,200,30);
add(c6);

c7.setBounds(100,680,600,20);
add(c7);

b1.setBounds(300,720,100,30);
29
add(b1);

b2.setBounds(420,720,100,30);
add(b2);

getContentPane().setBackground(Color.WHITE);

setSize(850,850);
setLocation(500,90);
setVisible(true);

b1.addActionListener(this);
b2.addActionListener(this);

public void actionPerformed(ActionEvent ae){

String a = null;
if(r1.isSelected()){
a = "Saving Account";
}
else if(r2.isSelected()){
a = "Fixed Deposit Account";
}
else if(r3.isSelected()){
a = "Current Account";
}else if(r4.isSelected()){
a = "Recurring Deposit Account";
}

Random ran = new Random();


long first7 = (ran.nextLong() % 90000000L) + 5040936000000000L;
long first8 = Math.abs(first7);

long first3 = (ran.nextLong() % 9000L) + 1000L;


long first4 = Math.abs(first3);

String b = "";
if(c1.isSelected()){
b = b+" ATM Card";
}
if(c2.isSelected()){
b = b+" Internet Banking";
}
if(c3.isSelected()){
b = b+" Mobile Banking";
}
if(c4.isSelected()){
b = b+" EMAIL Alerts";
30
}
if(c5.isSelected()){
b = b+" Cheque Book";
}
if(c6.isSelected()){
b = b+" E-Statement";
}

String c = t1.getText();

try{

if(ae.getSource()==b1){

if(b.equals("")){

JOptionPane.showMessageDialog(null, "Fill all the required fields");

}else{

conn c1 = new conn();


String q1 = "insert into signup3 values('"+a+"','"+first8+"','"+first4+"','"+b+"','"+c+"')";
String q2 = "insert into login values('"+first8+"','"+first4+"')";
c1.s.executeUpdate(q1);
c1.s.executeUpdate(q2);
JOptionPane.showMessageDialog(null, "Card Number: " + first8 + "\n Pin:"+ first4);

new Deposit().setVisible(true);
setVisible(false);
}

}else if(ae.getSource()==b2){
System.exit(0);
}

}catch(Exception ex){
ex.printStackTrace();
}

public static void main(String[] args){


new Signup3().setVisible(true);
}

package asimulatorsystem;

31
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;

public class Pin extends JFrame implements ActionListener{

JPasswordField t1,t2,t3;
JButton b1,b2;
JLabel l1,l2,l3,l4;

Pin(){

setFont(new Font("System", Font.BOLD, 22));


Font f = getFont();
FontMetrics fm = getFontMetrics(f);
int x = fm.stringWidth("PIN CHANGE");
int y = fm.stringWidth(" ");
int z = getWidth() - (3*x);
int w = z/y;
String pad ="";
//for (int i=0; i!=w; i++) pad +=" ";
pad = String.format("%"+w+"s", pad);
setTitle(pad+"PIN CHANGE");

l1 = new JLabel("CHANGE YOUR PIN");


l1.setFont(new Font("System", Font.BOLD, 35));

l2 = new JLabel("Current PIN:");


l2.setFont(new Font("System", Font.BOLD, 22));

l3 = new JLabel("New PIN:");


l3.setFont(new Font("System", Font.BOLD, 22));

l4 = new JLabel("Re-Enter New PIN:");


l4.setFont(new Font("System", Font.BOLD, 22));

t1 = new JPasswordField();
t1.setFont(new Font("Raleway", Font.BOLD, 22));

t2 = new JPasswordField();
t2.setFont(new Font("Raleway", Font.BOLD, 22));

t3 = new JPasswordField();
t3.setFont(new Font("Raleway", Font.BOLD, 22));

b1 = new JButton("SAVE");
b1.setFont(new Font("System", Font.BOLD, 18));
b1.setBackground(Color.BLACK);
b1.setForeground(Color.WHITE);
32
b2 = new JButton("BACK");
b2.setFont(new Font("System", Font.BOLD, 18));
b2.setBackground(Color.BLACK);
b2.setForeground(Color.WHITE);

b1.addActionListener(this);
b2.addActionListener(this);

setLayout(null);

l1.setBounds(220,130,800,60);
add(l1);

l2.setBounds(100,240,150,40);
add(l2);

l3.setBounds(100,300,150,40);
add(l3);

l4.setBounds(100,360,200,40);
add(l4);

t1.setBounds(310,240,360,40);
add(t1);

t2.setBounds(310,300,360,40);
add(t2);

t3.setBounds(310,360,360,40);
add(t3);

b1.setBounds(220,460,160,50);
add(b1);

b2.setBounds(400,460,160,50);
add(b2);

getContentPane().setBackground(Color.WHITE);

setSize(800,800);
setLocation(500,90);
setVisible(true);

public void actionPerformed(ActionEvent ae){

33
try{

String a = t1.getText();
String b = t2.getText();
String c = t3.getText();

if(ae.getSource()==b1){
if(t1.getText().equals("")){

JOptionPane.showMessageDialog(null, "Please Enter Current PIN");

}
if(t2.getText().equals("")){

JOptionPane.showMessageDialog(null, "Enter New PIN");


}
if (t3.getText().equals("")){

JOptionPane.showMessageDialog(null, "Re-Enter new PIN");


}

if(t2.getText().equals(t3.getText())){

conn c1 = new conn();


String q1 = "update bank set pin = '"+b+"' where pin = '"+a+"' ";
String q2 = "update login set pin = '"+b+"' where pin = '"+a+"' ";
String q3 = "update signup3 set pin = '"+b+"' where pin = '"+a+"' ";

c1.s.executeUpdate(q1);
c1.s.executeUpdate(q2);
c1.s.executeUpdate(q3);

JOptionPane.showMessageDialog(null, "PIN changed successfully");

new Transcations().setVisible(true);
setVisible(false);

}else{

JOptionPane.showMessageDialog(null, "PIN entered doesn't match");


}

}else if(ae.getSource()==b2){

new Transcations().setVisible(true);
34
setVisible(false);

}
}catch(Exception e){
e.printStackTrace();
System.out.println("error: "+e);
}

public static void main(String[] args){


new Pin().setVisible(true);
}
}

35
36
37
CONCLUSION
This system provides a computerized version of “atm” which will benefit for the atm simulator system. It makes
entire process computerized. It also has a facility for login.

There is a future scope of this facility that many more features related to banking system. we will manage the
system in future according to need of future.

REFERENCES
 www.youtube.in
 www.wikipedia.com
 www.google.com

38

You might also like