|
-
July 2nd, 2007, 06:03 AM
#1
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?
Last edited by __gini2; July 2nd, 2007 at 06:17 AM.
-
July 2nd, 2007, 08:41 AM
#2
Re: Creating a stack with data
 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?
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...
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
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
-
July 2nd, 2007, 08:56 AM
#3
Re: Creating a stack with data
 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
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|