CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2006
    Posts
    37

    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.

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    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?

    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.

  3. #3
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    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
    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
  •  





Click Here to Expand Forum to Full Width

Featured