hi, i need help with this question Design and implement a hierarchy for the following weather warnings: Normal, HighWind, Storm, Tornado, Snow, SnowStorm, Blizzard, Frost, Mist. Each class/object should be able to respond to the following method calls: ``report'' and ``action''. Write a driver program that asks the user for the number of weather warnings (s)he wants to create. Use this input to randomly create the necessary objects and store them in a container class. Use polymorphism to print out the reports of each of the warnings and associate actions.the proper use of abstract classes, inheritance and polymorphism is critical I have done the following hierarchy Weather (is at the top of hier. also an abstract class) | Normal , Snow, Highwind, mist, frost (they all extend from weather) | |snowstorm, blizzard(extend from snow)|,|Storm, Tornado(extend from highwind)| what i wanna know is how to go about writing the driver programme.
Here's some pseudocode which may point you in the right direction:
If you've overriden the toString() method of each of your classes so that it displays the proper weather warning, something like the above will work. Of course there are a million ways to do something like this, for example you could use an array instead of the static ints, but the above is an easy to read and easy to understand way of approaching a problem such as this. HTH [ January 06, 2004: Message edited by: Jason Menard ]