To sort out my final bits of OOP-4. I have created my different classes as expected and passed in my hashmap object but the question asks for info on each picked video/bookOnTape. To do this i have set up a class constructor and if/else's for each item but this has created 12 if/elses in the three subclasses and has left my code at well over 170 lines in total, well over the instructors 120 lines. Am i supposed to to individual item info or just generic class info using constructors?? Thanks for any enlightenment Sam
Sam Tilley SCJP, SCWCD
Joined: Mar 09, 2001
The key lesson here is polymorphism. Your program doesn't need to know the actual type of each video/book on tape because they know what type they are when they are instantiated. The program just needs to know the common relationship they share. I hope that doesn't give away too much.
Chicken Farmer ()
Joined: May 08, 2001
In addition to what Matt said, look at the UML diagram associated with the assignment. Believe it or not, it explains exactly what your program should look like, and how to utilize the classes in the way Matt stated (which I think was a perfectly valid hint).