| Author |
Cattle Drive- Assignment 4a
|
John Pisci
Ranch Hand
Joined: Dec 19, 2008
Posts: 44
|
|
Hi Folks,
I'm having a bit of trouble with this exercise. The objective is to run the program with a number, e.g java Say 22 and then get an output of twenty- two (up to a max of 99).
Anyway, 1-9 is working fine for me, but that's it. I can't for the life of me see the problem, so any help would be appreciated! Thanks!
[* Sorry John, since this is a Cattle Drive assignment we need to keep the code out of the question. -Pauline]
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32668
|
|
|
What did you pass as a command-line argument?
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32668
|
|
|
And, try passing some Strings to their substring method and see what you get from substring(2) especially when your input String is 2 characters long.
|
 |
John Pisci
Ranch Hand
Joined: Dec 19, 2008
Posts: 44
|
|
Thanks!
Just tried a very simple program (below) and can see where I was going wrong. How can you call the substring() method and only retrieve 1 character?
When the input was 'three', the output was:
b = hree
v = ree
|
 |
John Pisci
Ranch Hand
Joined: Dec 19, 2008
Posts: 44
|
|
Fixed it- thanks for your help!
Just changed the following;
|
 |
 |
|
|
subject: Cattle Drive- Assignment 4a
|
|
|