Reputation: 0 Apprentice
- New Members
- Active Posts:
- 10 (0.01 per day)
- 06-October 09
- Profile Views:
- Last Active:
- Jul 22 2011 01:55 PM
- Dream Kudos:
22 Jul 2011 - 08:40
Posts I've Made
Posted 22 Jul 2011I was dozy and missed "on the same line of a qwerty keyboard."
What are your ideas for solving?
I was thinking either and array or string, but im not sure how to go about checking for whats adjacent? I was going to make a two dim array but then i thought about it, and wasnt sure if that was going to work.
Posted 22 Jul 2011You're explanation of the assignment may not be complete or completely thought out. For example, which characters is the letter 'g' adjacent to on the qwerty keyboard? Are f, t, y, h, b, and v all adjacent to g? If that's the case, then you may have to develop a new lookup algorithm for each character that includes all physically adjacent characters.
What are you thinking? What tools are you comfortable with: arrays, hash maps, or what other collections?
Im usually pretty understanding with arrays, even how to store the data to text files things like that. Would a string be possible and then just use the scan utility? Im a little foggy when it comes to hash maps. Would it be easier if i attached the full problem on here? I actually have a link to the same problem that I found on a website. http://www.codechef....oblems/DDILEMMA
-Thanks a bunch!Do you have to do this in Java? Python seems easier.
Posted 22 Jul 2011While (thx = Thank You Guys!)
Thank You Guys! dunno if thats right but i think im close.... but thanks guys!
Posted 22 Jul 2011
Quoteif(textField.getText().trim().length() == 0) should do the trick without all a custom
Nope, that will only remove terminating spaces. Assuming you do it properly, removing spaces throughout the entire string, you're then going to have to display a message to the user explaining why the result is different from the input. Then - are you going to force the user to have what you selected? They might not want your result. So then you'd have to warn them you're about to change their choice and ask them if it's ok.
The above is assuming you use the code to provide the ability for the user to choose credentials in the first place. Of course, if you don't, then their space-laden input simply won't match the credentials and that's their own hard luck. In that case, you don't actually need to do anything anyway
Thanks goose, but im not sure i know how to go about that plainDocument? is there a tutorial on here, dont believe ive ever done that before...
Posted 21 Jul 2011Get the input string, loop through it and check if there's a space. If there is, throw an exception or just make a do while loop.
ok, thanks wow totally forgot about those, ive been doing too much CL. My java kind of disappeared from my brain. Im sure theres a tutorial on that some where on here. Thanks!
- Member Title:
- New D.I.C Head
- Age Unknown
- Birthday Unknown
- Click here to e-mail me