Member Avatar for smslive2

Hi Guys, Please i need someone who could hlp me write a simple ATM program for accepting PIN, Checking Balance and Withdrawing..

Recommended Answers

All 9 Replies

Hi Guys, Please i need someone who could hlp me write a simple ATM program for accepting PIN, Checking Balance and Withdrawing..

What's your progress? (aka post your code)

Member Avatar for smslive2

I am new in Java.... Please help

You said that you wantd help, not someone to do your program from scratch. There are a lot of solutions fro this problem, so don't expect someone just to hand you the complete code. You need to show us how you want to implement it in order to point you to the right direction.
Because such program could consist of only one file, or thousands of different classes depending on the level of complexity you want to add.

Several steps: one way:

Need to identify the card first
Need scanning device and analyze the acct number is right
then interface to type the pin

--
there should be a server program that can handle request from the ATMs. ATMs will create a socket connection to the server and communicate messages
--
First connect to server [can use Java socket classes for the purpose]
scan card and send the text to the server
Server sends response OK/Failed
Collect PIN then send to the Server using the socket
server will respond with fail/success.
[A local ATM database and asociated server program can also does the verification, may be insecure]

May use encryption for data communication
---
can keep a DB in the server side to keep information.
Each sent records can be matched with the db.

For the purpose, you need your logic to verify, DB connection logic is required and then query and verify is required. Decryption may be required if you use encryption

balances can be kept in db then you need to deduct the withdrawn amount

you should also, use the transaction management concept

So you see lots of issues to consider.

Several steps: one way:

Need to identify the card first
Need scanning device and analyze the acct number is right
then interface to type the pin

--
there should be a server program that can handle request from the ATMs. ATMs will create a socket connection to the server and communicate messages
--
First connect to server [can use Java socket classes for the purpose]
scan card and send the text to the server
Server sends response OK/Failed
Collect PIN then send to the Server using the socket
server will respond with fail/success.
[A local ATM database and asociated server program can also does the verification, may be insecure]

May use encryption for data communication
---
can keep a DB in the server side to keep information.
Each sent records can be matched with the db.

For the purpose, you need your logic to verify, DB connection logic is required and then query and verify is required. Decryption may be required if you use encryption

balances can be kept in db then you need to deduct the withdrawn amount

you should also, use the transaction management concept

So you see lots of issues to consider.

smslive2, asked for a simple program. I doubt it that if this is a school assignment they would want something that complex. Of course I don't blame you, since smslive2 didn't specify what was his problem you can give any solution you want

Maybe this class diagram will help you solve ur problem

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


public class ATM extends JFrame implements ActionListener
{   
    Bufferedeader br=new BufferedReader(new InputStreamReader(System.in));
    String b;
    Container c=getContentPane();   
    JPanel p1,p2;
    JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15;
    JTextArea t1;

    public ATM()
    {   
        super("ATM");
        t1=new JTextArea("                                  "+);
        t1.setMargin(new Insets(50,50,50,50));
        t1.setLineWrap(true);
        t1.setEditable(true);
        }                                
        p1=new JPanel();
        p2=new JPanel();

        b1=new JButton("1");
        b2=new JButton("2");
        b3=new JButton("3");    
        b4=new JButton("4");    
        b5=new JButton("5");
        b6=new JButton("6");
        b7=new JButton("7"); 
        b8=new JButton("8");    
        b9=new JButton("9");
        b10=new JButton("0");
        b11=new JButton();
        b12=new JButton("Deposit");
        b12.setBackground(Color.yellow);
        b13=new JButton("Withraw");
        b13.setBackground(Color.green);
        b14=new JButton("Cancel");
        b14.setBackground(Color.red);
        b15=new JButton("Enter");

        b1.addActionListener(this);
        b2.addActionListener(this);
        b3.addActionListener(this);
        b4.addActionListener(this);
        b5.addActionListener(this);
        b6.addActionListener(this);
        b7.addActionListener(this);
        b8.addActionListener(this);
        b9.addActionListener(this);
        b10.addActionListener(this);
        b12.addActionListener(this);
        b13.addActionListener(this);
        b14.addActionListener(this);
        b15.addActionListener(this);

        p1.setLayout(new FlowLayout());
        p1.add(t1);

        p2.setLayout(new GridLayout(3,4));
        p2.add(b1);
        p2.add(b2);
        p2.add(b3);
        p2.add(b4);
        p2.add(b5);
        p2.add(b6);
        p2.add(b7);
        p2.add(b8);
        p2.add(b9);
        p2.add(b10);
        p2.add(b11);
        p2.add(b12);
        p2.add(b13);
        p2.add(b14);
        p2.add(b15);


  setLayout(new GridLayout(2,1));
        add(p1);
        add(p2);
        setSize(400,200);
        show();
}
public void actionPerformed(ActionEvent e)
{
        String give;
        give=t1.getText();
        if(e.getSource()==b1)
        {
        t1.setText(give+"1");
        }
        if(e.getSource()==b2)
        {
        t1.setText(give+"2");
        }
        if(e.getSource()==b3)
        {
        t1.setText(give+"3");
        }
        if(e.getSource()==b4)
        {
        t1.setText(give+"4");
        }
        if(e.getSource()==b5)
        {
        t1.setText(give+"5");
        }
        if(e.getSource()==b6)
        {
        t1.setText(give+"6");
        }
        if(e.getSource()==b7)
        {
        t1.setText(give+"7");
        }
        if(e.getSource()==b8)
        {
        t1.setText(give+"8");
        }
        if(e.getSource()==b9)
        {
        t1.setText(give+"9");
        }
        if(e.getSource()==b10)
        {
        t1.setText(give+"0");
        }
        if(e.getSource()==b11)
        {
        t1.setText(give+"0");
        }
        if(e.getSource()==b14)
        {
        JOptionPane.showMessageDialog(null,"Transaction Cancelled");
        }
        if(e.getSource()==b15)
        {
        t1.setText(give+"");
        }
}
    public static void main (String []args)throws Exception
        {
        new ATM();
        }
    }

i want to put this up

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


public class ATM extends JFrame implements ActionListener
{   
    Bufferedeader br=new BufferedReader(new InputStreamReader(System.in));
    String b;
    System.out.print("Account Number:");
    System.out.print("Account Pin:");
    System.out.print("Account Balance:");
    Container c=getContentPane();   
    JPanel p1,p2;
    JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15;
    JTextArea t1;

    public ATM()
    {   
        super("ATM");
        t1=new JTextArea("                                  "+);
        t1.setMargin(new Insets(50,50,50,50));
        t1.setLineWrap(true);
        t1.setEditable(true);
        }                                
        p1=new JPanel();
        p2=new JPanel();

        b1=new JButton("1");
        b2=new JButton("2");
        b3=new JButton("3");    
        b4=new JButton("4");    
        b5=new JButton("5");
        b6=new JButton("6");
        b7=new JButton("7"); 
        b8=new JButton("8");    
        b9=new JButton("9");
        b10=new JButton("0");
        b11=new JButton();
        b12=new JButton("Deposit");
        b12.setBackground(Color.yellow);
        b13=new JButton("Withraw");
        b13.setBackground(Color.green);
        b14=new JButton("Cancel");
        b14.setBackground(Color.red);
        b15=new JButton("Enter");

        b1.addActionListener(this);
        b2.addActionListener(this);
        b3.addActionListener(this);
        b4.addActionListener(this);
        b5.addActionListener(this);
        b6.addActionListener(this);
        b7.addActionListener(this);
        b8.addActionListener(this);
        b9.addActionListener(this);
        b10.addActionListener(this);
        b12.addActionListener(this);
        b13.addActionListener(this);
        b14.addActionListener(this);
        b15.addActionListener(this);

        p1.setLayout(new FlowLayout());
        p1.add(t1);

        p2.setLayout(new GridLayout(3,4));
        p2.add(b1);
        p2.add(b2);
        p2.add(b3);
        p2.add(b4);
        p2.add(b5);
        p2.add(b6);
        p2.add(b7);
        p2.add(b8);
        p2.add(b9);
        p2.add(b10);
        p2.add(b11);
        p2.add(b12);
        p2.add(b13);
        p2.add(b14);
        p2.add(b15);


  setLayout(new GridLayout(2,1));
        add(p1);
        add(p2);
        setSize(400,200);
        show();
}
public void actionPerformed(ActionEvent e)
{
        String give;
        give=t1.getText();
        if(e.getSource()==b1)
        {
        t1.setText(give+"1");
        }
        if(e.getSource()==b2)
        {
        t1.setText(give+"2");
        }
        if(e.getSource()==b3)
        {
        t1.setText(give+"3");
        }
        if(e.getSource()==b4)
        {
        t1.setText(give+"4");
        }
        if(e.getSource()==b5)
        {
        t1.setText(give+"5");
        }
        if(e.getSource()==b6)
        {
        t1.setText(give+"6");
        }
        if(e.getSource()==b7)
        {
        t1.setText(give+"7");
        }
        if(e.getSource()==b8)
        {
        t1.setText(give+"8");
        }
        if(e.getSource()==b9)
        {
        t1.setText(give+"9");
        }
        if(e.getSource()==b10)
        {
        t1.setText(give+"0");
        }
        if(e.getSource()==b11)
        {
        t1.setText(give+"0");
        }
        if(e.getSource()==b14)
        {
        JOptionPane.showMessageDialog(null,"Transaction Cancelled");
        }
        if(e.getSource()==b15)
        {
        t1.setText(give+"");
        }
}
    public static void main (String []args)throws Exception
        {
        new ATM();
        }
    }

Please create a new thread for your own... Reviving almost 2 years old thread is not a good thing to do... Also, use the 'code' tag given by the forum to enhance your code display.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.