Except for the first assignment when I was cutting my teeth and SayB, I've really enjoyed the challenge of the Cattle Drive. Now I'm really stumped!
As you can tell, I'm on the SortNames assignment. I'm befuddled (read.. I really don't get it) about the extravagence of using an interface in this exercise.
To avoid repeating a bad idea, I will not indicate what solution I suggested to Marilyn in my email to her. She refered me to this discussion forum.
I got the exercise to work, sorting by first name. I used ArrayList and Collections to get to the output (First / Last)I needed. The last name sort solution still eludes me.
I did research in this forum to see if I could glean any hints on what to do, but it was all to no avail!
I dont't understand what advantage an interface has, and, once I have the interface, what benifit it will bring. Please help!
Marcus L�ubli, SCJP 1.4, CLP 5.0, SCWCD 1.4 (preparing)
I dont't understand what advantage an interface has, and, once I have the interface, what benifit it will bring. Please help!
It's been a while since I've thought about the SortNames assignment, but maybe I can help at a real general level...
An interface usually gives you the advantage of letting you add some functionality to your class that it might not otherwise have. In this case, you need to sort by last names. Before you can sort a bunch of names, though, you need to be able to compare those names to eachother. That's where a certain interface might come in handy.
If that's altogether too vague, please say so. I think I remember some helpful conversations on this one, I'll try to dig them up...
Hang in there! [ March 15, 2005: Message edited by: Pauline McNamara ]
Pauline McNamara
Sheriff
Joined: Jan 19, 2001
Posts: 4011
posted
0
Here's one favorite on SortNames. There's a bunch of good ones out there - a quick search using 'sort names' got 'em.
Are you having fun yet?
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18670
posted
0
[PM]: An interface usually gives you the advantage of letting you add some functionality to your class that it might not otherwise have.
You might add the functionality to an existing class, or you might just create a brand new class that implements the interface. Interfaces are very flexible in this respect.