public class Account extends javax.swing.JFrame {
/** Creates new form Account */
public Account() {
initComponents();
setTitle("Bank Account");
jTextArea1.setEditable(false);
}
/**
* @param args the command line arguments
*/
private int accountNumber =0;
private double balance =0;
public Account(int accNum, double bal)
{
accountNumber = accNum;
balance = bal;
}
public void deposit(double amount)
{
balance+=amount;
}
private void buttonCreateActionPerformed(java.awt.event.ActionEvent evt) {
Account newAcc = new Account(1234, 20000.0);
jTextArea1.setText("Account Created \nAccount Number ="+newAcc.ID+", Account Balance= "+newAcc.balance);
}
private void buttonDepositActionPerformed(java.awt.event.ActionEvent evt) {
/*i am trying to do : newAcc.deposit(5000.0);
jTextArea1.setText("new balance : "+balance);*/
/*but newAcc can't call the method deposit
i want it so that each time buttonDeposit is clicked, 5000 is added to the initial balance, which is 20000;
}
please help, i'm a newbie to java