Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

The Missing Link(ed-list) - BONUS LinkedListBox (BONUS ASSIGNMENT) Patterned after the ArrayBox assignment, please create your own implementation of LinkedList called LinkedListBox as explained in

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

The Missing Link(ed-list) - BONUS LinkedListBox (BONUS ASSIGNMENT) 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: =[==[==[=[=================================]=]==2==]= =[==[==[=[ Welcome to LinkBox 1=1==1==3= =[==[==[=[=================================]=]==]==]= 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 Grading Criteria [5.5 marks] Q2: Check to see if LinkedListNode and LinkedListBox classes are present and defined as generic. Check to see if all method functions are created as per specification above. 0.5 mark per method. 0.25 mark deduction per method missing an Exception. [1.5 marks] Q3: 1. Add an element(String) to our box. Insert 6 items. Then display the list. 1.5 marks if linked list correctly displays all six elements. Part marks otherwise. Q4: 2. Remove an element(String) from our box. Start with at least 6 elements in the list then: [1 marks] Remove the head element (index 0). Give 1 marks if element correctly removed. Part marks for reasonable attempt. [1 marks ] Remove the last element. Give 1 marks if element correctly removed. Part marks for reasonable attempt. [1.5 marks] Remove an element from the middle of the list (index 1). Give 1.5 marks if element correctly removed. Part marks for reasonable attempt. [1 marks] Q5: 3. Replace(set) an element(String) from our box. One (1) marks given if you can change an element from somewhere in the middle of the list (not head or tail). Part marks for reasonable attempt. [1.5 marks] Q6: 4. Insert an element(String) after index. Give 1.5 marks if you can insert an element in-between two middle elements. Example: insert at index 1 will put the element in-between element 1 and the current element 2. Part marks for reasonable attempt. [0.5 mark] Q7: 5. List the contents of the box. 0.5 mark so marks). 98: A testing script showing a trial run of the program with expected outputs for your testing. The Missing Link(ed-list) - BONUS LinkedListBox (BONUS ASSIGNMENT) 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: =[==[==[=[=================================]=]==2==]= =[==[==[=[ Welcome to LinkBox 1=1==1==3= =[==[==[=[=================================]=]==]==]= 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 Grading Criteria [5.5 marks] Q2: Check to see if LinkedListNode and LinkedListBox classes are present and defined as generic. Check to see if all method functions are created as per specification above. 0.5 mark per method. 0.25 mark deduction per method missing an Exception. [1.5 marks] Q3: 1. Add an element(String) to our box. Insert 6 items. Then display the list. 1.5 marks if linked list correctly displays all six elements. Part marks otherwise. Q4: 2. Remove an element(String) from our box. Start with at least 6 elements in the list then: [1 marks] Remove the head element (index 0). Give 1 marks if element correctly removed. Part marks for reasonable attempt. [1 marks ] Remove the last element. Give 1 marks if element correctly removed. Part marks for reasonable attempt. [1.5 marks] Remove an element from the middle of the list (index 1). Give 1.5 marks if element correctly removed. Part marks for reasonable attempt. [1 marks] Q5: 3. Replace(set) an element(String) from our box. One (1) marks given if you can change an element from somewhere in the middle of the list (not head or tail). Part marks for reasonable attempt. [1.5 marks] Q6: 4. Insert an element(String) after index. Give 1.5 marks if you can insert an element in-between two middle elements. Example: insert at index 1 will put the element in-between element 1 and the current element 2. Part marks for reasonable attempt. [0.5 mark] Q7: 5. List the contents of the box. 0.5 mark so marks). 98: A testing script showing a trial run of the program with expected outputs for your testing

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions