Originally posted by Layne Lund:
I'm not likely to read through all of your code, but I'm more than happy to help if you have specific questions. I suggest that you start with just a little bit at a time. Barry's example main() above is one place to start. Perhaps you can implement the supporting Meta class and its methods. You might find it helpful to add some System.out.println() (SOP) calls to make sure things work the way you expect.[QB]
I know that is a lot of code, but I figured everyone might have a better understanding if I attached the files. I have my main method, but I do not understand what I have to print out. I realize that I must store the information and calculate some things, but I dont know what those particular things are called to print. This is where my biggest issue is.
Originally posted by Layne Lund:
Please keep this discussion in the other thread. It will help keep the coherence in case anyone else wants to join in.
Also, just to clarify, it doesn't look like this program uses inheritence at all, or at least in only limited areas. When you get a chance, you should probably research what inheritence is all about. The main reason I make this claim is that inheritence uses the "extends" keyword, which I don't see in your program. In fact, from your description, it doesn't look like inheritence is appropriate, so you aren't necessarily missing anything here.
Regards,
Layne
Originally posted by Barry Higgins:
Right for a start have you at least got some kind of a class with a
public static void main(String[] args)
in it?
This function will be the entry point for your application. From here you can create all of the instances of the classes you need to write and call any functions needed.
As far as I can see the the next thing that would be handy to have would be something to parse those strings of yours. You say in your post that you reckon this should be straight forward GREATbut if you have any problems there is always help here.
These functions I assume will fit into Meta so in your calling class (the one with the main in it) you will say
You will obviously need you implement these methods in your Meta class. Have a go at these for a start and then post back if your having problems!
Originally posted by Ernest Friedman-Hill:
[QB]
As far as the string sorting goes, your routine is a good start, but it actually only puts the first element into the right place; you need two nested loops, one varying the "left hand" index, and the other the "right hand" index, to sort the whole array. Think about that for a bit and let's see what you can come up with.
The argument list of sortString() is a little wrong. The "char temp" declaration belongs inside the routine, and the String[] parameter (which you call "name" inside the routine) needs to be named in the parameter list.
QB]
Originally posted by Ernest Friedman-Hill:
Hi Rory,
Welcome to JavaRanch!
Hmm. This is rather a lot to pack into one assignment.
First, the vowel-counting looks mostly OK to me, if the point is to count all the vowels in all the words; otherwise, it needs a bit of rearranging. In particular, the println() call would move inside the outer loop.
You don't need to construct a StringBuffer to get the length of a String; String has its own perfectly good length() method you can call directly.
That long and scary conditional with all the comparisons-to-vowels could be made shorter in several ways, but none of them are too beginnerish so I'd leave well enough alone.
As far as the string sorting goes, your routine is a good start, but it actually only puts the first element into the right place; you need two nested loops, one varying the "left hand" index, and the other the "right hand" index, to sort the whole array. Think about that for a bit and let's see what you can come up with.
The argument list of sortString() is a little wrong. The "char temp" declaration belongs inside the routine, and the String[] parameter (which you call "name" inside the routine) needs to be named in the parameter list.
Finally, of course, something in main() probably ought to call sortString(), or it won't actually run.