I have a class Bank
public class Bank {
public static final double INTEREST = 0.1; //Interest rate charged on overdrawn accounts
private Vector customers=new Vector();
private Address address;
public Bank() {
//address = null;
}
public Bank(Address add) {
customers = new Vector ();
address = add;
}
// add a Customer to the customers Vector
public void addCustomer(Customer cus) {
customers.add(cus);
}
// get and set methods
public Vector getCustomers() {
return customers;
}
public void setCustomers(Vector v) {
customers = v;
}
}
now i am adding customers to the Banks class
public void actionPerformed(ActionEvent e){
int custnum=b.getBank().getCustomers().size()+1;
ad=new Address(txtCustStreet.getText(),txtCustCity.getText(),txtCustPostCode.getText());
cus=new Customer(txtCustName.getText(),ad,custnum, Integer.parseInt(txtoverdraft.getText()));
if (e.getSource() == jbExit) {
frame.dispose();
}
if (e.getSource() == jbSubmit) {
// b.getBank().setCustomers(null);
b.getBank().addCustomer(cus);
}
System.out.println(b.getBank().getCustomers().size());
}
when i am printing the vector size after adding 1 customers it prints 1 when i add two customers it prints like 1 2 while i add 3 customers it prints like 1 2 3
i want only only to print 3 when i add 3 customers not 1 2 3 please help me out thanks