Program reads in a word and outputs the last character then a "," then the last 2 characters of the word
what program reads and send some outPut
This is what i hope to output
Enter a word: dog
g, go, god
Normally i don't do homework assignments, but hey , i'm in a good mood..
I haven't tested this code, but i think it should do the trick.
String input = "dog"; String output = ""; for (int i = (input.length() - 1); i >= 0; i--) output += (input.charAt(i)); for(int i = output.length(); i > 0 ; i--) System.out.println(output.substring(output.length()-i,output.length())); }
Nope, doesn't work - and as a general rule we don't just hand students completed solutions to their homework problems.
well, it needs a litle finetuning i agree on that ;)
but it should get him started on figuring it out on his own..