On Sep 4, 7:07 pm, "Estes, Tammy" <[EMAIL PROTECTED]> wrote:
> In the generatNewName() section of my program I have this:
>
> public static void generateNewName(String[] theNames) {
The requirement is to have a static method which generates the new
name, not which generates and print the new name. Hence do not use
void in the method, but return a String.
Then in the main method, you will have a String variable (initialized
to nothing at the beginning), which catches the generated name
returned by this method. Then you simply print this String variable.
For this to work, you should initialize the String to be returned to
an empty String at the beginning of this method.
>
> System.out.println("generateNewName: Start");
>
> for (int i=0; i<theNames.length; i++){
here you just construct your new name, with a construct like this:
generatedName = generatedName + ....
... is for you to guess what it should be. Hint, see the charAt
method.
>
> char [] charArr = "X".toCharArray();
>
> theNames[i].getChars(1, 2, charArr, 0);
>
> System.out.println(charArr);
You have to drop the three lines above.
Then you close the loop and return the new name generated.
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---