This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
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
Matthew Phillips
Ranch Hand
Joined: Mar 09, 2001
Posts: 2676
posted
0
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.
Matthew Phillips
jason adam
Chicken Farmer ()
Ranch Hand
Joined: May 08, 2001
Posts: 1932
posted
0
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).