/* A test
*/
import java.util.Scanner;
public class WordInput
{
public static void main( String [ ] args)
{
Scanner scan = new Scanner ( System.in );
System.out.print ( "Enter a word >" );
String word = scan.nextLine( );
char character1 = word.charAt (1);
char character2 = word.charAt (2);
char character3 = word.charAt (3);
char character4 = word.charAt (4);
char character5 = word.charAt (5);
char character6 = word.charAt (6);
char character7 = word.charAt (7);
char character8 = word.charAt (8);
System.out.println ( "Your word is (with spaces) " + word + " and " +character1 + " " + character2 + " " + character3);
}
}
The problem asks for the user to end a word (as a string) and then for your program to take that word and display it and then display the word with spaces between every character
like say you entered " longword" .... I need the program to format the string and say "l o n g w o r d "
I'm so frustrated. I've looked all over the damn internet for 2 hours for this problem
-Travis
oh and ignore the charat code above, i was just bs'ing to make myself feel better.


Ask A New Question
Reply





MultiQuote






|