Creating a stack with data
I have to create a class 'Dear' that has a stack that will allow addition of 'event' information into it. The event information will include event type and date of event. All the data has to be sorted automatically while it is being added into the stack.
Please help me with this because I am not sure of how to do this.
I have another class 'Event'(ADT class) that has details : Event type and date of event.
Can I call the ADT event class in the Dear class?
Re: Creating a stack with data
Quote:
Originally Posted by __gini2
I have to create a class 'Dear' that has a stack that will allow addition of 'event' information into it. The event information will include event type and date of event. All the data has to be sorted automatically while it is being added into the stack.
Please help me with this because I am not sure of how to do this.
The Java SDK has a Stack class you can use. What are you not sure about?
Quote:
I have another class 'Event'(ADT class) that has details : Event type and date of event.
I guess you'll be adding instances of this class to the stack...
Quote:
Can I call the ADT event class in the Dear class?
Probably - what do you mean by 'call the ADT event class' ? Why would you want to do that?
Computer Science is a science of abstraction -creating the right model for a problem and devising the appropriate mechanizable techniques to solve it...
A. Aho & J. Ullman
Re: Creating a stack with data
Quote:
Originally Posted by __gini2
All the data has to be sorted automatically while it is being added into the stack.
I just noticed this - do you understand what a stack is? the whole point of a stack is that the data is stored in the order it is added. Sorting a stack would make it useless...
The greatest obstacle to discovery is not ignorance, but the illusion of knowledge...
D. Boorstin