Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

create a class called ManyLinkedLists. It will contain a static method called createLinkedList(). That method takes an argument that is a constant defined in the

create a class called ManyLinkedLists. It will contain a static method called createLinkedList(). That method takes an argument that is a constant defined in the ManyLinkedLists class. The identifier of the constants should describe a type of linked list. When the createLinkedList method is called, it should return a linked list object of the type identified by the constant. For example: DoubleEndedList del = ManyLinkedLists.createLinkedList(ManyLinkedLists.DOUBLEENDEDLIST); Give the createLinkedList method the ability to return the linked lists described below:

  • A double-ended linked list. That kind of linked list is described in chapter 5 of your text (starts on page 198).
  • A doubly linked list. That kind of linked list is described in chapter 5 of your text (starts on page 221).

Note that in order to create the above linked lists you will have to create something equivalent to the Link class from exercise 5A. Use a long instance variable as the data within your link class or classes. Your project should contain any other classes you need. Include a ManyLinkedListsDriver class that tests the ManyLinkedLists class, its method, and the data structures that the method can return. The peculiar features of the two forms of linked list should be clearly demonstrated.

Include a document in your submitted project that clearly explains the difference between a double-ended linked list and a doubly linked list.

exercise 5A is as follow

Step 1

Your text has an example of LinkedList class. Convert the class so that the Link objects have a single long instance variable -- call it "data" -- and the Link instance variable..

Step 2

Then add the following capabilities to the class. A constructor that takes an array of longs as an argument. The contents of the array are use to create Link objects that become objects in the LinkedList. A "search" method that takes a long argument and returns a boolean value. The method searches the LinkedList object for Link objects with a data value that matches the long argument. It returns a true or false based on whether or not a matching value is present in the LinkedList. A "numberOfValues" method that takes a long argument and returns an int value. The method searches the LinkedList object for Link objects with a data value that matches the long argument. It returns a numeric value that is the number of times the long argument is present in the LinkedList. A "replace" method that takes two long arguments and returns a void. The method finds all occurrences of the first long value in the Links of the LinkedList and replaces their data value with the method's second long value. A "zero" method that replaces all values in the LinkedList's Link objects with zeros.

A "getArray" method that returns a long array. The method returns long array that contains the long data values in the Link objects of the LinkedList

Step 3 Give the project a LinkedListDriver class that contains your main method.

Instantiate a LinkedList object, using the array constructor.

Demonstrate the isEmpty, insertFirst, deleteFirst, and displayList methods.

Also demonstrate the methods from Step 2. Remember that your output should clearly state what you are doing in your code.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions

Question

Create a workflow analysis.

Answered: 1 week ago