Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I require some Help!!

 
Rand Norwood
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im not very experienced in java and im having a problem with one of the questions.
Here is the exercise:

Im suppose to write a problem that eccepts a 5-letter word from user
and then it generates all possible three letter words or combinations that can be derived from the 5-letter word.

Please in anyway u can.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We're not too keen on doing homework for people around here. But we are more than happy to help with problems. So what problems are you having? Have you written any code yet? Does it compile? Do you get errors?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, start small. Break your project down into smaller pieces. (For example, first write a program that accepts a 5-letter word from the user, then verifies this by printing it back out to the console.)

Second, work smaller. Write a few lines of code, compile, and run. If there are no errors and it behaves as expected, then add a few more lines, compile, and run... If there are errors or it behaves differently than expected, then you know where the problem is.

Third, consult the API documentation...
1.4.2: http://java.sun.com/j2se/1.4.2/docs/api/index.html
1.5.0: http://java.sun.com/j2se/1.5.0/docs/api/index.html

Finally, when you get stuck, post specific questions -- preferrably with examples of your code. You might also want to specify which version of Java you're using (especially since you appear to be asking for Command Line input from the user).
[ July 13, 2005: Message edited by: marc weber ]
 
Dale Seng
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are these words supposed to be in the dictionary, or just every possible combination?
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please show us what you have tried and explain what problems you have encountered. We will be more than happy to help you from there.

Layne
 
Paul Santa Maria
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi -

Marc's advice is perfect: try to find the "pieces" of the problem (for example: "accept user input", then "accept 5 characters of user input and treat those 5 characters as a word", etc etc).

So how far have you gotten? Have you identified any "pieces" yet? Have you tried typing in any code and running it yet?

It's OK no answer "no" to any/all of these questions. Just let us know how far you've gone, and where you're stuck. We'd be happy to help!

Sincerely .. PSM
[ July 13, 2005: Message edited by: Paul Santa Maria ]
 
vijaya bharath
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


I cant say this is the correct way but my idea is ,after taking 5 letter word as input, take a for loop staring to end of the string. with that for loop take the first letter to last letter of the string. i think u know how to do that means if the for loop index is 1 take charat 1 and write an inner for loop and take the letters from index+1 of outer loop to the last letter. print 2 letters fro there.

if u wont get this i can tell like this, bcs u r string is 5 letter word
outer for loop is from 0-4. if outer for loop index is 0 then the inner for loop starts from 1-4. u print for each turn 2 letters.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic