0% found this document useful (0 votes)
181 views

BANKCODE

The document provides code for a Bank Management System project with instructions on how to organize the code into separate class files. It includes code for two classes - a 'conn' class that establishes a database connection, and a 'Login' class that contains the login form code. It instructs the user to copy the code into separately named class files matching the class names. It also provides code for a third 'Signup' class for a registration form.

Uploaded by

SHIVANI KOTHARI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
181 views

BANKCODE

The document provides code for a Bank Management System project with instructions on how to organize the code into separate class files. It includes code for two classes - a 'conn' class that establishes a database connection, and a 'Login' class that contains the login form code. It instructs the user to copy the code into separately named class files matching the class names. It also provides code for a third 'Signup' class for a registration form.

Uploaded by

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

BANK MANAGEMENT SYSTEM PROJECT CODE

A - Below is the source code of the project.


B - Create separate class files for every class.
C - Copy the code of one class (ex: login.java) and paste
it in Login class file, do it for every class.

1 - Create your first class with name 'conn' and paste


the code below in it

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);

/*

Note : package ASimulatorSystem; this line will give error if your package

name is different and make sure your database name is project2.

*/

2 - Create next class with name 'Login' and paste the code below in it
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);

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);

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);

/*

Note : Make sure your name of class, file name and constructor name should be
same and start with

capital 'L' in Login.

*/

3 - Create next class with name 'Signup'

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");

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));

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");

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","Septemb
er","October","November","December"};

c2 = new JComboBox(month);

c2.setBackground(Color.WHITE);

String year[] =
{"1990","1991","1992","1993","1994","1995","1996","1997","1998","1999","20
00","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);

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);

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";

}
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);

/*

Note : Your database should be connected properly, tables should be made


properly else it will not go to the next frame.

*/

4 - Create next class with name 'Signup2'


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;

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:");

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);

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);

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){

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();

public static void main(String[] args){

new Signup2().setVisible(true);

}
}

5 - Create next class with name 'Signup3'

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)");

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));

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);

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);

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";

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);
}

6 - Create next class with name 'Transactions'. This is also your main class after
Login and Signup.

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;
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));

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){

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();

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

System.exit(0);

public static void main(String[] args){

new Transcations().setVisible(true);

}
7 - Create next class with name 'Deposit'. This frame will open from the
Transaction frame.

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;

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);

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{

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);

}
}

8 - Create next class with name 'deposit1'. This frame will open just after signup
completes.

package ASimulatorSystem;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;

import java.text.SimpleDateFormat;

import java.util.*;

public class deposit1 extends JFrame implements ActionListener{

JTextField t1,t2;

JButton b1,b2,b3;

JLabel l1,l2,l3;
deposit1(){

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);

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{

conn c1 = new conn();

String q1= "insert into bank values('"+b+"','"+a+"',null,'"+a+"')";

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 deposit1().setVisible(true);

/*

Note : There are two deposit classes. Open will open just after you completes
signup and other will get open after you click Deposit button on Transaction
frame
*/

9 - Create next class with name 'Withdrawl'.

package ASimulatorSystem;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;

public class Withdrawl extends JFrame implements ActionListener{

JTextField t1,t2;

JButton b1,b2,b3;

JLabel l1,l2,l3,l4;
Withdrawl(){

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

Font f = getFont();

FontMetrics fm = getFontMetrics(f);

int x = fm.stringWidth("WITHDRAWAL");

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+"WITHDRAWAL");

l1 = new JLabel("MAXIMUM DAILY WITHDRAWAL");

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

l2 = new JLabel("IS RS.10,000");

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

l3 = new JLabel("PLEASE ENTER YOUR AMOUNT");


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

l4 = new JLabel("Enter Pin");

l4.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("WITHDRAW");

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);

l4.setBounds(620,10,80,30);

add(l4);

t2.setBounds(700,10,40,30);

add(t2);

l1.setBounds(90,100,800,60);

add(l1);

l2.setBounds(270,160,800,60);

add(l2);

l3.setBounds(120,260,800,60);

add(l3);
t1.setBounds(210,340,360,50);

add(t1);

b1.setBounds(220,400,160,50);

add(b1);

b2.setBounds(400,400,160,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 Withdraw");

}else{
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+"',null,'"+d+"','"+balance+"')";

c1.s.executeUpdate(q1);

}
JOptionPane.showMessageDialog(null, "Rs. "+a+" Debited
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 Withdrawl().setVisible(true);

10 - Create next class with name 'FastCash'.

package ASimulatorSystem;

import java.awt.*;

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

import java.sql.*;

import java.util.*;

public class FastCash extends JFrame implements ActionListener{

JLabel l1,l2;

JButton b1,b2,b3,b4,b5,b6,b7,b8;

JTextField t1;

FastCash(){

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

Font f = getFont();

FontMetrics fm = getFontMetrics(f);

int x = fm.stringWidth("FAST CASH");

int y = fm.stringWidth(" ");

int z = getWidth() - (4*x);

int w = z/y;

String pad ="";

//for (int i=0; i!=w; i++) pad +=" ";


pad = String.format("%"+w+"s", pad);

setTitle(pad+"FAST CASH");

l1 = new JLabel("SELECT WITHDRAWL AMOUNT");

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

l2 = new JLabel("Enter PIN");

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

t1 = new JTextField();

t1.setFont(new Font("System", Font.BOLD, 13));

b1 = new JButton("Rs 100");

b1.setFont(new Font("System", Font.BOLD, 18));

b1.setBackground(Color.BLACK);

b1.setForeground(Color.WHITE);

b2 = new JButton("Rs 500");


b2.setFont(new Font("System", Font.BOLD, 18));

b2.setBackground(Color.BLACK);

b2.setForeground(Color.WHITE);

b3 = new JButton("Rs 1000");

b3.setFont(new Font("System", Font.BOLD, 18));

b3.setBackground(Color.BLACK);

b3.setForeground(Color.WHITE);

b4 = new JButton("Rs 2000");

b4.setFont(new Font("System", Font.BOLD, 18));

b4.setBackground(Color.BLACK);

b4.setForeground(Color.WHITE);

b5 = new JButton("Rs 5000");

b5.setFont(new Font("System", Font.BOLD, 18));

b5.setBackground(Color.BLACK);

b5.setForeground(Color.WHITE);

b6 = new JButton("Rs 10000");

b6.setFont(new Font("System", Font.BOLD, 18));

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

b7 = new JButton("BACK");

b7.setFont(new Font("System", Font.BOLD, 18));

b7.setBackground(Color.BLACK);

b7.setForeground(Color.WHITE);

b7 = new JButton("EXIT");

b7.setFont(new Font("System", Font.BOLD, 18));

b7.setBackground(Color.BLACK);

b7.setForeground(Color.WHITE);

setLayout(null);

l2.setBounds(640,10,60,40);

add(l2);

t1.setBounds(710,10,60,40);

add(t1);

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){

try{

String a = t1.getText();

double balance = 0;

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

conn c1 = new conn();

ResultSet rs = c1.s.executeQuery(" select * from bank where pin =


'"+a+"' ");

if(rs.next()){

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

balance = rs.getDouble("balance");

balance-=100;

String q1= "insert into bank


values('"+pin+"',null,100,'"+balance+"')";

c1.s.executeUpdate(q1);

JOptionPane.showMessageDialog(null, "Rs. "+100+" Debited


Successfully");

new Transcations().setVisible(true);

setVisible(false);

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

conn c1 = new conn();


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

if(rs.next()){

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

balance = rs.getDouble("balance");

balance-=500;

String q1= "insert into bank


values('"+pin+"',null,500,'"+balance+"')";

c1.s.executeUpdate(q1);

JOptionPane.showMessageDialog(null, "Rs. "+500+" Debited


Successfully");

new Transcations().setVisible(true);

setVisible(false);
}

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

conn c1 = new conn();

ResultSet rs = c1.s.executeQuery(" select * from bank where pin =


'"+a+"' ");

if(rs.next()){

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

balance = rs.getDouble("balance");

balance-=1000;

String q1= "insert into bank


values('"+pin+"',null,1000,'"+balance+"')";

c1.s.executeUpdate(q1);
}

JOptionPane.showMessageDialog(null, "Rs. "+1000+" Debited


Successfully");

new Transcations().setVisible(true);

setVisible(false);

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

conn c1 = new conn();

ResultSet rs = c1.s.executeQuery(" select * from bank where pin =


'"+a+"' ");

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

balance = rs.getDouble("balance");

balance-=2000;

String q1= "insert into bank


values('"+pin+"',null,2000,'"+balance+"')";

c1.s.executeUpdate(q1);

JOptionPane.showMessageDialog(null, "Rs. "+2000+" Debited


Successfully");

new Transcations().setVisible(true);

setVisible(false);

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

conn c1 = new conn();

ResultSet rs = c1.s.executeQuery(" select * from bank where pin =


'"+a+"' ");

if(rs.next()){

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

balance = rs.getDouble("balance");

balance-=5000;

String q1= "insert into bank


values('"+pin+"',null,5000,'"+balance+"')";

c1.s.executeUpdate(q1);

}
JOptionPane.showMessageDialog(null, "Rs. "+5000+" Debited
Successfully");

new Transcations().setVisible(true);

setVisible(false);

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

conn c1 = new conn();

ResultSet rs = c1.s.executeQuery(" select * from bank where pin =


'"+a+"' ");

if(rs.next()){

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

balance = rs.getDouble("balance");
balance-=10000;

String q1= "insert into bank


values('"+pin+"',null,10000,'"+balance+"')";

c1.s.executeUpdate(q1);

JOptionPane.showMessageDialog(null, "Rs. "+10000+" Debited


Successfully");

new Transcations().setVisible(true);

setVisible(false);

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

}catch(Exception e){

e.printStackTrace();

System.out.println("error: "+e);

public static void main(String[] args){

new FastCash().setVisible(true);

11 - Create a class with name 'Pin'.


package ASimulatorSystem;

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);

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){

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);

setVisible(false);

}catch(Exception e){

e.printStackTrace();

System.out.println("error: "+e);

public static void main(String[] args){

new Pin().setVisible(true);

}
12 - Create next class with name "MiniStatement"

package ASimulatorSystem;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;

public class MiniStatement extends JFrame implements ActionListener{


JTable t1;

JButton b1;

String x[] = {"Customer Name","Date","Deposit","Withdraw","Balance"};

String y[][] = new String[20][5];

int i=0, j=0;

MiniStatement(){

super("Mini Statement");

setSize(1200,650);

setLocation(200,200);

try{

conn c1 = new conn();

String s1 = "select * from bank";

ResultSet rs = c1.s.executeQuery(s1);

while(rs.next()){

y[i][j++]=rs.getString("customer_name");

y[i][j++]=rs.getString("date");

y[i][j++]=rs.getString("deposit");

y[i][j++]=rs.getString("withdraw");

y[i][j++]=rs.getString("balance");

i++;
j=0;

t1 = new JTable(y,x);

}catch(Exception e){

e.printStackTrace();

b1 = new JButton("Print");

add(b1,"South");

JScrollPane sp = new JScrollPane(t1);

add(sp);

b1.addActionListener(this);

public void actionPerformed(ActionEvent ae){

try{

t1.print();

}catch(Exception e){}

public static void main(String[] args){


new MiniStatement().setVisible(true);

Code for Interview

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et
nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

2:30 PM

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy