posted 20 years ago
Hi all,
I have to make a program that will take fouyr strings, received through JOptionPane, and print to screen these 4 strings in both ascending and descending alphabetic sequence. I'm sure it's simple, but it's giving me trouble. Ideally what I'd like to do is read in the strings, store them, then pass those 4 strings as arguments to construct a "word" object. Then call methods on this object which will fulfill the requirements.
It's these methods that are giving me trouble. I DON'T want to use an array at all, so havings aid that, I gather I'd use the method string1.compareToIgnoreCase(string2), which makes perfect sense. However, how do I make this work properly without simply hardcoding in a multitude of if statements that address every possible permutation? Though that would work, I can't think of anything uglier. ;-)
Any help here would be greatly appreciated. I haven't posted any code, as all I have is literally the method headers with no implementation code within them! Thanks in advance!
shane
I've been trying to change the world for years, but they just won't give me the source code.