COSC2006 Lab 6 – The Linked List Coding – Submit all .java files to the LMS. The Single Node. Create the SingleNode clas

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

COSC2006 Lab 6 – The Linked List Coding – Submit all .java files to the LMS. The Single Node. Create the SingleNode clas

Post by answerhappygod »

COSC2006 Lab 6 – The Linked ListCoding – Submit all .java files to the LMS.The Single Node. Create the SingleNode class that hasfollowing:(1) Protected data variables for the item in the node (type String)and the next node (typeSingleNode). Because these variables are protected instead ofprivate, we can use themwithin the same package.(2) Two constructors: SingleNode(String item) and SingleNode(Stringitem, SingleNode next)
The Linked List. Create the SingleLinkedList class with thefollowing methods, but Do notinclude a size variable (or any other variable to count the numberof elements in the listpenalty -0.5 marks) in your code - you must calculate the number ofitems in the list.public boolean isEmpty()public int size()public void insert(String item, int i)public String remove(int i)public void removeAll()public String get(int i)public int find(String item)Also implement a toString method to print the list elements with anarrow -> between them,including the last item. Show the null at the end of the list. DoNOT use a Linked List or anyother Java-provided data structure. Doing so will result in a markof zero for this lab.Write a LinkedListException and implement it when an operationcan’t be completed. Yourexception should say what the error is and why it happened.Write a test class that:(1) Creates a new Linked List that holds String values(2) Inserts each of the following items into your list:a. Milk, Eggs, Celery, Bananas, Apples, Oranges, Cookies,Steakb. Print the list after every insertion(3) Removes Celery and Oranges from the list. Print the list aftereach removal.
Copyright © 2021-2022 by Prof. Johnny Console, AlgomaUniversity.All rights reserved. No parts of this work may be reproduced by anymeans without priorwritten permission from the author.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply