A LinkNode structure or class which will have two attributes - a data attribute and a pointer attribute to the next node. The data attribute of the LinkNode should be the Dollar class of Lab 1. A...

1 answer below »


  1. A LinkNodestructure or classwhich will have two attributes - adataattribute and a pointer attribute to thenextnode. The data attribute of the LinkNode should be the Dollar class of Lab 1.

  2. A Singly Linked Listclasswhich will be composed of three attributes - acountattribute, a LinkedNode pointer/reference attribute pointing to thestartof the list and a LinkedNode pointer/reference attribute pointing to theendof the list. Since this is a class, make sure all these attributes are private.

  3. The attribute names for the Node and Linked List are the words in bold in #1 and #2.

  4. For the Linked List, implement the most common linked-list behaviors as explained in class -

    1. getters/setters/constructors/destructors for the attributes of the class,

    2. (a) create new list, (b) add data, (c) delete data, (d) find data, (e) count of data items in the list, (f) is list empty, (g) empty/destroy the list and (h) print all data items in a list.

    3. Any other methods you think would be useful in your program.



  5. A Stackclassderived from the Linked List but with no additional attributes and the usual stack methods - (a) create stack, (b) push, (c) pop, (d) peek, and (e) destroy/empty the stack. Ensure that the Stack objects do not allow Linked List functions to be used on them.

  6. A Queueclassderived from the Linked List but with no additional attributes and the usual queue methods - (a) create queue, (b) enqueue, (c) dequeue, (d) peekFront, (e) peekRear, and (f) destroy/empty the queue. Ensure that the Queue objects do not allow Linked List functions to be used on them.

  7. Ensure that all your classes are mimimal and cohesive with adequate walls around them. Try to reuse and not duplicate any code. Define interfaces as needed, so you can reuse them in your project.

  8. Then write a main driver program that will demonstrate all the capabilities of your ADTs as follows -

    1. Create seven (7) Node objects of Dollars to be used in the program.

    2. Demonstrate the use of your LinkedList with the seven Dollar Node objects inserted/deleted/searched in a random order. Remember, you will need to print the contents of the List several times to demonstrate the functionality.

    3. Demonstrate the use of your Stack with the seven Dollar Node objects pushed/popped/peeked in a random order different from the one in LinkedList.

    4. Demonstrate the use of your Queue with the seven Dollar Node objects enqueued/dequeued/peeked in a random order different from both the LinkedList and Stack.

    5. Demonstrate use of all the methods above by providing sufficient information to screen for actions being taken.

    6. Restrict all your input / output to the main driver program only.



  9. Remember your classes should be in 2 code files - one for LinkedNode and LinkedList and the other for Stack and Queue. Including the code file for your Dollar class as well as main, your submission will have 4 code files. Remember to include pre/post documentation and comment blocks as necessary in your code files. In your submission, also include screenshots.

Answered Same DayNov 08, 2021

Answer To: A LinkNode structure or class which will have two attributes - a data attribute and a pointer...

Arun Shankar answered on Nov 13 2021
149 Votes
StacksAndQueues/.DS_Store
__MACOSX/StacksAndQueues/._.DS_Store
StacksAndQueues/.classpath

    
        
            
        
    
    
    
StacksAndQueues/.project

     StacksAndQueues
    
    
    
    
        
             org.eclipse.jdt.core.javabuilder
            
            
        
    
    
        ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here