I notice doing a search on the Saloon that there seem to have been no recent postings on Say 4b and what a nightmare it can be. I got up to this tricky one relatively quickly but since then for the past 9 days have been struggling one way or another over the xmas period with it when i had time. It works (although still a bit long) up to 1 billion but i am having problems with the middle part and anything over 10 billion. I have tried parsing my input into a long variable and breaking it down to an int but still it is giving me some problems and telling me i have a number format exception. I am trying to split down a number by int numBill = (int) (input / anumber) although this still doesn't seem to work. Can anyone give me a hint as to why it is not going as well as it should Thanks Sam
Say 4b is truly a test of endurance. If you try searching this forum you will find many posts on this very subject, and one of them may give you the very hint you need! Sorry, I'm too lazy to look up the links for you. Good luck!
Joined: Dec 05, 2001
Thanks i have looked at quite a few old queries through the search and they have helped a lot. But i just thought that a problem such as Say 4b deserved a recent thread in the hope of catching any passing chunks of wisdom that happened to float past and garner any newbies ideas / offer support to any others also removing clumps of hair. Sam
Originally posted by Sam Tilley: I have tried parsing my input into a long variable and breaking it down to an int but still it is giving me some problems and telling me i have a number format exception. I am trying to split down a number by int numBill = (int) (input / anumber) although this still doesn't seem to work.
Seems like this should work if input is a long and anumber is an int.
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Sam, You and I are new cowboys and we have to stick together. Here's a tip that really helped me ... "I did a stint teaching English in Japan (haven't we all?). Our numbering system is significantly easier than theirs. To learn it, you only need to know how to count to 100 - after that, it's just 1-999 x, 1 - 999x, 1-999x,...1-9 and 99x. eg. 212,156,345 two hundred twelve MILLION, 1hundred fifty six THOUSAND, 3 hundred and forty five. The commas we use when writing numbers should be the clue everyone needs (I think). Perhaps a 2 dimensional array... (or would that be nitpicked?) I've got it working but have to wait for assignment 2 and 3 to be nitpicked first." I forget the name of the person (sorry), but this got me on my way.
That was me! First time I've visited in many months - moved on to project management and haven't had much time/inclination to code in java these days - and there's a quote from me. Cool! Anyhow, glad it helped