W
Woot4Moo
Hi guys I am working on a program and I cant seem to figure out where
it is I am going wrong.
It is involving Bank accounts and PINs. I have a Bank class and a
BankAccount class.
In my BankAccount class I have a variable declared as private static
int pin.
as well as:
public static int checkPin()
{
return pin;
}
In my Bank class I have
public double getBalance(String nameOfOwner, int finalPin)
{
int pin = BankAccount.checkPin();
if(pin != finalPin) return -1;
// rest of code to get balance, which works properly.
}
My question is how do I make it so the pin can be referenced for each
account and also so that pin does NOT get over written everytime a new
account is created. Because currently what happens is the pin is only
stored for the last account created.
Thanks
it is I am going wrong.
It is involving Bank accounts and PINs. I have a Bank class and a
BankAccount class.
In my BankAccount class I have a variable declared as private static
int pin.
as well as:
public static int checkPin()
{
return pin;
}
In my Bank class I have
public double getBalance(String nameOfOwner, int finalPin)
{
int pin = BankAccount.checkPin();
if(pin != finalPin) return -1;
// rest of code to get balance, which works properly.
}
My question is how do I make it so the pin can be referenced for each
account and also so that pin does NOT get over written everytime a new
account is created. Because currently what happens is the pin is only
stored for the last account created.
Thanks