daisy polly

Greenhorn
+ Follow
since Oct 10, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by daisy polly

Oh I get It. thanx a bunch It WORKS!!!
18 years ago
I still get 7 digit numbers.I think it contains the correct value.
18 years ago
I chaged the code but the same problems occurs.The variables are diffrent but they have the same data.Thanks a bunch for helping.If you can solve this problem i will be really grateful.

18 years ago
I don't understand what is wrong.I put the system.out statement and the numbers always remain the same. I still don't get why it bring numbers greater than 6.
18 years ago
My code prints 7 digits while I want it to say "RUN OUT OF NUMBERS" as soon as it more than 6.

The code now look like this:


18 years ago
It runs out of numbers as soon as the number becomes 7 ditit long.I need a condition to do that. I can't seem to get the condition to work.
18 years ago
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
18 years ago
thanks a bunch guys!.I will start and let you know how it goes.
18 years ago
Thanks for the suggestions. I have no idead how to start with the code could you please give me a little help how the structure of the code will be. Thanks again.

Daisy
18 years ago
Hi,
Hi,

I am making a small Bank program and in that I am making a class called AccountNumberMaker which looks something like this:
public class AccountNumberMaker{

private int nextAvailableAccountNumber = 100009;
}

public int nextAccountNumber() {
nextAccountNumber++
}

I need to know how to make all the accounts numbers 6 digits long not more and not less than 6 also the first digit should not be be zero and also (first_digit +last_digit )%10 should be zero. How to do this in Java I am so confused. Any Help will be appreciated.

Thanks
Daisy
18 years ago