Create a doubly linked list class named linkeditemlist

Assignment Help Data Structure & Algorithms
Reference no: EM13970966

Data Structures and Algorithms

Assignment

The objectives of this assignment are to:

1. Further enhance your knowledge and skill in Java.

2. Gain an understanding and experience with doubly linked lists.

3. Gain an understanding and experience using generics.

  1. Gain further experience in using Javadoc documentation.

5. Continue to practice good programming techniques.

Part I:

Create a doubly linked list class named LinkedItemList that implements the following interface:

/**

 * An ordered list of items.

 */

public interface ItemList<E> {

/**

* Append an item to the end of the list

*

* @param item - item to be appended

*/

public voidappendItem(E item);

/**

* Insert an item at a specified index position

*

* @param item - item to be inserted

       * @param index - index position where to insert the item

* @throwIllegalArgumentException if index is < 0 or > no of items

*/

public void insertItemAt(E item, int index);

/**

 * Remove all items from the list

 */

public void clear();

/**

* Return an item at a specified index

*

* @param index - index of the item to return

* @return the item at the specified index

* @throwIllegalArgumentExceptionif index is < 0 or >= no of items

*/

public E getItem(int index);

/**

      * Return the index of the first occurrence of an item in the list.

      *

      * @return index of the first occurrence in the list, -1 if not found

      */

public intindexOf(Eitem);

/**

 * Get an ItemIterator to iterate over items in the list.

 *

 * @return an ItemIterator to iterate over items in the list

 */

public ItemIterator<E>iterator();

/**

* Remove an item at a specified index

*

* @param index - index of the item to be removed

* @return the removed item

* @throw IllegalArgumentExceptionif index is < 0 or >= no of items

*/

public E removeItemAt(int index);

/**

* Remove the first occurrence of an item in the list.

*

* @item - item to be removed

* @return true if an occurrence of the item was found and removed,

*         otherwise false

*/

public booleanremoveItem(Eitem);

/**

 * Return the number of items currently in the list

 *

 * @return the number of items in the list

 */

public intgetNoItems();

}

/**

 * An iterator over an ItemList

 */

public interface ItemIterator<E> {

/**

 * Return true if the iteration has more items

 *

 * @return true if the iteration has more items, otherwise false

 */

public booleanhasNextItem();

/**

 * Return next item from iteration

 *

 * @return next item from iteration

 * @throw NoSuchElementException if the iteration has no more items

 */

public E nextItem();

/**

 * Remove last item from returned iteration

 *

 * @throw NoSuchElementException if no item has been returned or if

 *        the item has previously been deleted

 */

public voidremoveItem();

}

You will need the appropriate constructors. In addition, you may also implement other methods that may be useful for the assignment (where possible define code in just one place). 

Part II:

Write a program to thoroughly test all of the methods of your LinkedItemList class.  Once you are confident is it working correctly, proceed to part III.

Part III:

On the tomcat drive in cosc310 you will find an eclipse project called assmt2.  On importing this project you will find a program CompanyReport which is similar to the Company and Bank projects.  That is they use arrays for 1 to N relationships between business objects.  Make the following modifications to CompanyReport to use ItemList and LinkedItemList.

1) Change the Company class to use LinkedItemList for your list of departments (instead of using an array).   Define the type of the departments variable to be a ItemList.  You will need to modify for loop accordingly.

2) Change Department to use LinkedItemList for the list of employees (instead of an array).  Define the employees variable as a ItemList of Employees.

3) Remove the methodgetEmployee(int index) from Department.  Instead add an ItemIteratorgetEmployees() method.  It just calls the iterator method on the employees variable and returns its ItemIterator.  Modify Department where needed to use getEmployees to iterate over the list of employees.

Additional Requirements:

1. Place ItemList and LinkedItemList into package edu.iup.cosc310.util

2. Provide a fast implementation for appendItem(), e.g., does not need to walk the list to get to the end.

3. Provide a fast implementation for getNoItems(), e.g., does not need to walk the list to count the number of items.

Reference no: EM13970966

Questions Cloud

Employees take in their negotiation with the financial firm : What kind of negotiations could help engage Indian employees and overcome some of the cultural problems encountered? How might culture play a role in the approach the Indian employees take in their negotiation with the financial firm?
What is the centripetal force acting on the car : What is the minimum coefficient of statistic friction between the tires and the track that will maintain this situation? If the tiles have a radius of 1.2m, what is the angular velocity of the tire? How many rotations do the tiles make on a single..
Variety of approaches to purchasing power parity : You were introduced to a variety of approaches to purchasing power parity. Select one purchasing power parity approach and explain why you chose it. Assess the approach you selected, identifying its characteristics and advantages for forecasting. In ..
Explain the background of one of the training videos : Explain the background of one of the training videos, the content, the learning objectives that it would meet, the time frame it will take, and the style of learners it will appeal to
Create a doubly linked list class named linkeditemlist : Create a doubly linked list class named LinkedItemList that implements the following interface. Write a program to thoroughly test all of the methods of your LinkedItemList class.
What is the amount of the companys accounts receivable : Calculating Float You have $35,400 on deposit with no outstanding checks or uncleared deposits. One day you write a check for $3,700 and then deposit a check for $5,300. What is your collection? What is the amount of the company's accounts receivable..
Find the accounting and cash break even units of production : The Marvel Mfg. Company is considering whether or not to construct a new robotic production facility. The cost of this new facility is $600,000 and it is expected to have a six-year life with annual depreciation expense of $100,000 and no salvage val..
Market value is related to idea of maximizing shareholder : The idea of maximizing market value is related to the idea of maximizing shareholder value, as market value is the price at which an asset would trade in a competitive setting. The sole concentration on shareholder value has been criticized, for conc..
Find he angular velocity of the system : Find: Free body diagram of the puck (looking at it from the side) when the center of rotation is to the left of it.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Calculate the wait time between two iterations

Question on Retry factor and Retry and Retry Interval, practical question is asked on this to calculate the wait time between two iterations?

  Postorder traversal print a heap in sorted order?

Will preorder, inorder, or postorder traversal print a heap in sorted order? why or why not? use the following numbers to prove your point 85 86 88 89 90 91 92

  Implement the insertion sort algorithm for sorting an array

Implement the Insertion Sort algorithm for sorting an array of n elements. In this algorithm, the main loop index i runs from 1 to n-1. On the ith iteration, the element a[i] is "inserted" into its correct position among the subarray a[0..i].

  Is an array that is in reverse sorted order a heap

What is the expectation of the index of the maximum element in the array and expectation of the index of the minimum element in the array?

  Implement various database-related algorithms

Implement various database-related algorithms and do experiments on efficiency/effectiveness.

  Write algorithm in pseudo code for bank account

Write an algorithm in pseudo code to settle following question: A bank account starts out with $10,000. Interest is compounded monthly at 6% per year(0.5% per month).

  In the following problems you will need tobulldefine the

in the following problems you will need tobulldefine the problem by constructing a defining diagrambullcreate a

  Justify characterizing data types according to task taxonomy

Justify characterizing data types according to task taxonomy. Support your response. Assess the value to an interface designer, of being familiar with the seven basic tasks and create an argument for which three of the seven basic tasks are the mo..

  What is the role or place of structured methodologies

What is the role or place of structured methodologies, data, and algorithms? What differs between object-oriented and object-based languages

  Can you find the element of an array

We would like to determine whether a given array A has a majority element, and if so, find the element.

  Create algorithm to count of integers less than average

Create the algorithm which will prompt for and get 10 integers from the operator at terminal, and then count number of integers whose value is less than average value of integers.

  Draw the human encoding tree of these six characters

Show how to nd the maximum spanning tree of a graph, that is, the spanning tree of largest total weight.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd