I am write a program rotate()
This method is supposed to bring the the # of end letters to the front based on the user input
for example:
String word = "hellos";
tester.rotate(word,1); results in shello
tester.rotate(word,5); results in hello [which would be the limit because hello has word length of 5]
The following is the code that I wrote to rotate once and so on.
I am working on making the code general and so specific such as if I say rotation = rotationable and let the user try different int values based on the word length. For some reason, my general code is not really working and I need help
if (rotation == 1)
{
for (int i = word.length()-1; i>=word.length()-1; i--)
{
rotated = rotated + word.charAt(i);
}
for (int i = 0; i<=word.length()-2; i++)
{
rotated = rotated + word.charAt(i);
}
}
System.out.println(tester.rotate(word, 1));
I cannot seem to come up with a code that will let me input any int value instead of 1 with out saying rotation == 1 in my real code.
Answer: shello
If you want to see what I am working on, I will send it.