wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Cattle Drive- Assignment 4a Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Cattle Drive- Assignment 4a" Watch "Cattle Drive- Assignment 4a" New topic
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: 38033
    
  22
What did you pass as a command-line argument?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38033
    
  22
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;

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cattle Drive- Assignment 4a
 
Similar Threads
Assignment 1.4 Extra Credit
New Free Online Java Compiler and Runner
User-defined exceptions
parsing data and storing in the xml
problem with try catch