i need to input text in a textfield like accountbalance,withraw,deposit,and functions of "cancel","Enter","Deposit",Withdraw, and i need to give a receipt after the transaction. i need help you can add in my yahoomail <EMAIL SNIPPED>

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();
	if(b.equals())	
	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()==b12)
		{
		t1.setText(give+"0");
		}
		if(e.getSource()==b13)
		{
		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();
		}
	}

Edited 5 Years Ago by peter_budo: Keep It Organized - Do not ask anyone (member or moderator) for help by email or PM

1. Please start using code tags as [code] YOUR CODE HERE [/code]
2. Make sure you do not double post, if you have slow internet connection wait for reply that your post was published and do not submit it for second time

Or you will get plenty of infractions and will be banned.

--------------------Configuration: <Default>--------------------
H:\ATM.java:11: <identifier> expected
System.out.print("Account Number:");
^
H:\ATM.java:11: illegal start of type
System.out.print("Account Number:");
^
H:\ATM.java:12: <identifier> expected
System.out.print("Account Pin:");
^
H:\ATM.java:12: illegal start of type
System.out.print("Account Pin:");
^
H:\ATM.java:13: <identifier> expected
System.out.print("Account Balance:");
^
H:\ATM.java:13: illegal start of type
System.out.print("Account Balance:");
^
H:\ATM.java:15: illegal start of type
if(b.equals())
^
H:\ATM.java:15: <identifier> expected
if(b.equals())
^
H:\ATM.java:15: ';' expected
if(b.equals())
^
H:\ATM.java:15: illegal start of type
if(b.equals())
^
H:\ATM.java:16: ';' expected
JPanel p1,p2;
^
H:\ATM.java:16: <identifier> expected
JPanel p1,p2;
^
H:\ATM.java:23: illegal start of expression
t1=new JTextArea(" "+);
^
H:\ATM.java:28: <identifier> expected
p1=new JPanel();
^
H:\ATM.java:29: <identifier> expected
p2=new JPanel();
^
H:\ATM.java:31: <identifier> expected
b1=new JButton("1");
^
H:\ATM.java:32: <identifier> expected
b2=new JButton("2");
^
H:\ATM.java:33: <identifier> expected
b3=new JButton("3");
^
H:\ATM.java:34: <identifier> expected
b4=new JButton("4");
^
H:\ATM.java:35: <identifier> expected
b5=new JButton("5");
^
H:\ATM.java:36: <identifier> expected
b6=new JButton("6");
^
H:\ATM.java:37: <identifier> expected
b7=new JButton("7");
^
H:\ATM.java:38: <identifier> expected
b8=new JButton("8");
^
H:\ATM.java:39: <identifier> expected
b9=new JButton("9");
^
H:\ATM.java:40: <identifier> expected
b10=new JButton("0");
^
H:\ATM.java:41: <identifier> expected
b11=new JButton();
^
H:\ATM.java:42: <identifier> expected
b12=new JButton("Deposit");
^
H:\ATM.java:43: <identifier> expected
b12.setBackground(Color.yellow);
^
H:\ATM.java:43: <identifier> expected
b12.setBackground(Color.yellow);
^
H:\ATM.java:44: <identifier> expected
b13=new JButton("Withraw");
^
H:\ATM.java:45: <identifier> expected
b13.setBackground(Color.green);
^
H:\ATM.java:45: <identifier> expected
b13.setBackground(Color.green);
^
H:\ATM.java:46: <identifier> expected
b14=new JButton("Cancel");
^
H:\ATM.java:47: <identifier> expected
b14.setBackground(Color.red);
^
H:\ATM.java:47: <identifier> expected
b14.setBackground(Color.red);
^
H:\ATM.java:48: <identifier> expected
b15=new JButton("Enter");
^
H:\ATM.java:50: <identifier> expected
b1.addActionListener(this);
^
H:\ATM.java:50: illegal start of type
b1.addActionListener(this);
^
H:\ATM.java:51: <identifier> expected
b2.addActionListener(this);
^
H:\ATM.java:51: illegal start of type
b2.addActionListener(this);
^
H:\ATM.java:52: <identifier> expected
b3.addActionListener(this);
^
H:\ATM.java:52: illegal start of type
b3.addActionListener(this);
^
H:\ATM.java:53: <identifier> expected
b4.addActionListener(this);
^
H:\ATM.java:53: illegal start of type
b4.addActionListener(this);
^
H:\ATM.java:54: <identifier> expected
b5.addActionListener(this);
^
H:\ATM.java:54: illegal start of type
b5.addActionListener(this);
^
H:\ATM.java:55: <identifier> expected
b6.addActionListener(this);
^
H:\ATM.java:55: illegal start of type
b6.addActionListener(this);
^
H:\ATM.java:56: <identifier> expected
b7.addActionListener(this);
^
H:\ATM.java:56: illegal start of type
b7.addActionListener(this);
^
H:\ATM.java:57: <identifier> expected
b8.addActionListener(this);
^
H:\ATM.java:57: illegal start of type
b8.addActionListener(this);
^
H:\ATM.java:58: <identifier> expected
b9.addActionListener(this);
^
H:\ATM.java:58: illegal start of type
b9.addActionListener(this);
^
H:\ATM.java:59: <identifier> expected
b10.addActionListener(this);
^
H:\ATM.java:59: illegal start of type
b10.addActionListener(this);
^
H:\ATM.java:60: <identifier> expected
b12.addActionListener(this);
^
H:\ATM.java:60: illegal start of type
b12.addActionListener(this);
^
H:\ATM.java:61: <identifier> expected
b13.addActionListener(this);
^
H:\ATM.java:61: illegal start of type
b13.addActionListener(this);
^
H:\ATM.java:62: <identifier> expected
b14.addActionListener(this);
^
H:\ATM.java:62: illegal start of type
b14.addActionListener(this);
^
H:\ATM.java:63: <identifier> expected
b15.addActionListener(this);
^
H:\ATM.java:63: illegal start of type
b15.addActionListener(this);
^
H:\ATM.java:65: <identifier> expected
p1.setLayout(new FlowLayout());
^
H:\ATM.java:65: illegal start of type
p1.setLayout(new FlowLayout());
^
H:\ATM.java:65: ')' expected
p1.setLayout(new FlowLayout());
^
H:\ATM.java:65: ';' expected
p1.setLayout(new FlowLayout());
^
H:\ATM.java:65: illegal start of type
p1.setLayout(new FlowLayout());
^
H:\ATM.java:65: <identifier> expected
p1.setLayout(new FlowLayout());
^
H:\ATM.java:66: <identifier> expected
p1.add(t1);
^
H:\ATM.java:66: <identifier> expected
p1.add(t1);
^
H:\ATM.java:68: <identifier> expected
p2.setLayout(new GridLayout(3,4));
^
H:\ATM.java:68: illegal start of type
p2.setLayout(new GridLayout(3,4));
^
H:\ATM.java:68: ')' expected
p2.setLayout(new GridLayout(3,4));
^
H:\ATM.java:68: ';' expected
p2.setLayout(new GridLayout(3,4));
^
H:\ATM.java:68: illegal start of type
p2.setLayout(new GridLayout(3,4));
^
H:\ATM.java:68: <identifier> expected
p2.setLayout(new GridLayout(3,4));
^
H:\ATM.java:68: ';' expected
p2.setLayout(new GridLayout(3,4));
^
H:\ATM.java:68: illegal start of type
p2.setLayout(new GridLayout(3,4));
^
H:\ATM.java:68: <identifier> expected
p2.setLayout(new GridLayout(3,4));
^
H:\ATM.java:69: <identifier> expected
p2.add(b1);
^
H:\ATM.java:69: <identifier> expected
p2.add(b1);
^
H:\ATM.java:70: <identifier> expected
p2.add(b2);
^
H:\ATM.java:70: <identifier> expected
p2.add(b2);
^
H:\ATM.java:71: <identifier> expected
p2.add(b3);
^
H:\ATM.java:71: <identifier> expected
p2.add(b3);
^
H:\ATM.java:72: <identifier> expected
p2.add(b4);
^
H:\ATM.java:72: <identifier> expected
p2.add(b4);
^
H:\ATM.java:73: <identifier> expected
p2.add(b5);
^
H:\ATM.java:73: <identifier> expected
p2.add(b5);
^
H:\ATM.java:74: <identifier> expected
p2.add(b6);
^
H:\ATM.java:74: <identifier> expected
p2.add(b6);
^
H:\ATM.java:75: <identifier> expected
p2.add(b7);
^
H:\ATM.java:75: <identifier> expected
p2.add(b7);
^
H:\ATM.java:76: <identifier> expected
p2.add(b8);
^
H:\ATM.java:76: <identifier> expected
p2.add(b8);
^
H:\ATM.java:77: <identifier> expected
p2.add(b9);
^
H:\ATM.java:77: <identifier> expected
p2.add(b9);
^
H:\ATM.java:78: <identifier> expected
p2.add(b10);
^
100 errors

Process completed.


there still errors = (

Because System.out.print() cannot be used right away inside a class! The class also needs a constructor. You need to put whatever you are doing inside another method for using later. In your main(), you cannot just call "new ATM();" but you need to assign it to a variable. I think you need to start with how to code a Java program first. You do not have an idea of Java program structure yet. You could find a tutorial here.

This article has been dead for over six months. Start a new discussion instead.