
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Implement an items stock system using your singly linked list from LAB 05: Exercise # 1
Add an item should input from user all the required data for an item and add the item in front of linked list using the method addToHead().
Remove an item should input itemID from user and delete it from the list using the method delete(itemID), if present.
Show list of items should display the items in list using the method printAll().
Exit should close the program (running in infinite loop) using return or break statement .
A node in this list should contain following information about items:
class Item {
public long itemID;
public String itemName;
public String manufacturer;
public int version;
public String countryOfOrigin;
public int year;
public Node next;
public Node(long ID, String itnm, String manufac, int ver, String origin, int y) {
itemID = ID; itemName = itnm; manufacturer = manufac;
version = ver; countryOfOrigin = origin; year = y;
}
}
Modify and use the program code in Lab 05 according to this problem. You can remove the methods which are not required to solve this problem.
Sample run of the program
Items in Store
1. Add an item
2. Remove an item
3. Show list of items
4. Exit
Your choice?

Transcribed Image Text:Implement an items stock system using_your singly linked list from LAB 05: Exercise # 1
1. Add an item should input from user all the required data for an item and add the item in front of linked list using the method
addToHead().
2. Remove an item should input itemlD from user and delete it from the list using the method delete(itemID), if present.
3. Show list of items should display the items in list using the method printAll().
4. Exit should close the program (running in infinite loop) using return or break statement .
• A node in this list should contain following information about items:
class Item {
public long itemlD;
public String itemName;
String manufacturer;
public int versountryOfOrigin;
bijgnd
String
public int
public Node next;
public Node(long ID, String itnm, String manufac, int ver, String origin, int y) {
itemID = ID; itemName = itņm; maňufacturer = manufac;
version = vér; countryOfOrigin - origin; year = y;
year;
• Modify and use the program code in Lab 05 according to this problem. You can remove the methods which are not
required to solve this problem.
Sample run of the program
Items in Store
1. Add an item
2. Remove an item
3. Show list of items
4. Exit
Your choice?
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps

Knowledge Booster
Similar questions
- A for construct is used in programming to build a loop that processes a list of things. In order to achieve this, it runs endlessly so long as there are things to process. Is this statement true or false? explain yourself.arrow_forwardA loop that iteratively processes a given list is called a for construct. So long as there are things to process, it will keep running. To what extent is this statement accurate or false?arrow_forwardThe for construction is a loops that iteratively processes a given list. Consequently, it works so long even though there are objects to process. What about this claim: true or false?arrow_forward
- in Jave create a method work() with the follow instructions: If the work() method is passed a non-null then it must return a new List that contains some or all of the elements in data. The elements of the new List must be aliases for (not copies of) the objects in the List it is passed. If there are no sign attributes (i.e., the array is null or has 0 elements) then the work() method must return an empty List. If any of the conditions represented by the sign attribute holds for a particular element that that element must be included in the result (i.e., the conditions must be combined using a logical OR). The elements in the returned List must be in the same order they appeared in the original List (though not all elements must be in the result). public List<T> work(List<T> g){arrow_forwardCreate a nested class called DoubleNode that allows you to create doubly-linked lists with each node containing a reference to the item before it and the item after it (or null if neither of those items exist). Then implement static methods for the following operations: insert before a given node, insert after a given node, remove a given node, remove from a given node, insert at the beginning, insert at the end, remove from a given node, and remove a given node.arrow_forwardA consecutive sequence a list of numbers that are organized in increasing order with the next eleme. one bigger than the current. Write a non-recursive method "lengthConsec", which takes an IntNode myList as the parameter and returns the length of the consecutive sequence in myList. To simplify the implementation, you can assume that there is no more than one consecutive sequence in the list. For example, in the following linked list, the consecutive sequence begins at node "5" and ends at node "7", so lengthConsec (myList) should return 3 in this case. myList 8 13 4 public class IntNode { 12 private int m_data; private IntNode m_link; Consecutive sequence 6 7 28arrow_forward
- Jump to level 1 A list of fruits is searched for Pear using binary search. Fruits list: [Apple, Apricot, Berry, Grape, Lemon, Lime, Orange, Peach, Pear, Plum] What is the first fruit searched? Pick ↑ What is the second fruit searched? Pick 1 Check ✪ Next 2 3 4 5arrow_forwardExercise 2.3. What is wrong with this procedure, which is supposed to return True if the element x occurs in the list items, and False otherwise? def member (x, items): for i in items: if x == 1: return True else: return Falsearrow_forwardDefine a collection “ArrayList” to store the students' names. Use a loop to take 5 students’ names from the user and store them in the collection. Add two student names to the collection and remove the last name in the list. Insert a student name in third place in the collection. Sort the names alphabetically. Ask the user to enter a student name and search for it in the collection and prints the result as “Found” or “Not Found”. Print the whole collection using the enhanced for loop. (java)arrow_forward
- This is using Data Structures in Javaarrow_forwardCan you please answer this fast and with correct answer. Thankyouarrow_forwardA summer camp ofes a moming sesnandan atemon sesin The is momiglist otis he names ofal chidenatedingthe moming sesin and he is tenonlistontinsthe names ofal chide aterdn the atemon sesin. atending boh esins is ound in istnd etums fale chewise. FOR EACH child IN norninglist (MISSING CODE> IF (1SFound (afternoonlList, child) APPEND (lunchList, child)arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY