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

  Write a suitable logical description of the robot.

Write a sentence describing the Go action. Use a successor-state axiom.

  Create an idef1x entity relationships diagram

The Metropolitan Housing Agency is a non profit corporation that advocates the development and improvement of low income housing.

  Design an adt for a two-color

Design an ADT for a two-color, double-stack ADT that consists of two stacks one "red" and one "blue" and has as its operations color-coded versions of the regular stack ADT operations.

  Prove that a neighbor of a node of level f in the bfs tree

Prove that a neighbor of a node of level f in the BFS tree has level f - 1, f, or f + 1. Analyze the complexity of the breadth-first search algorithms in terms of N, lEI, and D (the network diameter).

  Creating uml collaboration diagrams

Create UML collaboration diagrams using Microsoft Visio or another making tool capable of creating properly formatted UML collaboration diagrams.

  Explain types of information systems

Question 1. Explain five types of information systems, and give an example of each. Question 2. Describe three common reasons for a systems request. Try and find one not listed in the text.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  Develop a flowchart and provide a brief explanation

Create a hierarchy chart depicting the chosen situation and develop a flowchart and provide a brief explanation for it.

  What numbers are compared to 72 if a sequential search is

question 1. what numbers are compared to 72 if a sequential search is used 2 5 7 9 11 17 18 21 28 30 45 5465 69 72.

  Design a version of mergesort that uses the auxiliary array

Given a list L[0:n - 1], one way of maintaining a sorted order of L is to use an auxiliary array Link[0:n - 1].

  Barwon taichi is a small and dynamic business located in

barwon taichi is a small and dynamic business located in geelong and melbourne. it provides self-defence fitness and

  Sketch portion of decision tree via quicksort to sort array

Suppose you are using quicksort to sort array A with 6 distinct elements a1, a2, ..., a6. Sketch portion of the decision tree which corresponds to th ordering a3

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