Hi,
I am having problem's putting a simple if conditions in my code.I have an Account class which produces numbers. I have some conditions in my code already for examples the length of the number should not be greater that 6.What I want is that for example when my program runs out of numbers I want to print and Error message and then quit.My code is:
public class AccountNumberMaker{
private int nextAvailableAccountNumber = 1000090;
String accountString = (Integer.toString(nextAvailableAccountNumber));
public int nextAccountNumber()
{
while(accountString.length() == 6)
{
nextAvailableAccountNumber++;
int i_first = nextAvailableAccountNumber /100000;
int i_last = nextAvailableAccountNumber %100000;
if( (i_first + i_last) % 10 == 0 )
{
return nextAvailableAccountNumber;
}
}
return nextAvailableAccountNumber;
}
}
Thanks a bunch
Daisy