Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

LinkedListBox Patterned after the ArrayBox assignment, please create your own implementation of LinkedList called LinkedListBox as explained in class. Refer to the class slides on

LinkedListBox

Patterned after the ArrayBox assignment, please create your own implementation of LinkedList called LinkedListBox as explained in class. Refer to the class slides on linked lists. Specifically, implement your generic classes as:

public class LinkedListNode { public E element; public LinkedListNode next; } public class LinkedListBox { public LinkedListNode head; public LinkedListNode tail; public int count = 0; }

Within the LinkedListBox class, implement the following methods:

public boolean add(E e). Returns true after adding an element to the end of the list.

public E get(int idx). Returns element at index position idx.

public E set(int idx, E e). Changes the element at position idx to e. Returns old element.

public E remove(int idx). Removes element at position idx from the list and returns it.

public int size(). Self-explanatory

public boolean isEmpty(). Self-explanatory

public Integer find(E e). Search for element e in the linked list and return its index position or return null if not found.

public E removeFirst(). Remove and return the element at the head of the list.

public E removeLast(). Remove and return the element at the tail of the list.

public void addFirst(E e). Add an element to the front of the list.

public void insert(int idx, E e). Insert an element right after the index idx position.

Create a driver class called LinkedListBoxDriver. Provide the user a menu:

=[==[==[=[=================================]=]==]==]= =[==[==[=[ Welcome to LinkBox ]=]==]==]= =[==[==[=[=================================]=]==]==]= Choose... 1. Add an element(String) to our box. 2. Remove an element(String) from our box. 3. Replace(set) an element(String) from our box. 4. Insert an element(String) after index. 5. List the contents of the box. 6. Exit program

please don't answer the same solution what already exist in chegg. Thanks

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

DB2 9 For Linux UNIX And Windows Advanced Database Administration Certification Certification Study Guide

Authors: Roger E. Sanders, Dwaine R Snow

1st Edition

1583470808, 978-1583470800

More Books

Students also viewed these Databases questions

Question

How autonomous should the target be left after the merger deal?

Answered: 1 week ago