You are to implement an interactive dynamic single Linked List structure. This List will be based on the node definition given on the next page. Since you already know how to create classes, this should be a logical extension. Your goal is to create a Linked List class which contains "node" elements. Your program should contain the ability to dynamically (meaning the user can select what each choice at anytime): 1. Insert at head (new node at head) 2. Insert at tail (new node placed at the end of the list) 3. Print (prints out the contents of the list in order) 4. Remove from head (remove first node) [watch special case]] 5. Remove from tail (remove last node) (watch special cases] 6. Find a target value (an isThere routine) (tells you if the target is in the list) 7. Give total # of occurrences of a specified value (how many items of target are in the list) 8. Give a total # of nodes (total items in list) This program will track integers from the user. Be aware that some of these methods above will force you to create other routines/methods. You are coding dynamic structures - code accordingly. See page 2 for more specificity on the methods. Doliverables: 1) Clearly documented, professionally written source code (in a running form) 2) 3 runs showing all the user menu items. (output) (screenshots are fine) 3) Grading is based on: a) Meets all requirements (80%) b) Quality of source code (comments, logic, pre/post conditions, etc.) (20%) For extra credit, you may do the following: (will require research on your own) [DO NOT DO THIS UNLESS YOUR PROGRAM ALREADY FULLY WORKSI 1) Upgrade the "insert" method to allow for a "variable location insert". (this isn't easy) (5%) 2) Attempt to make 1 or more of the methods recursive. (5%)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question
You are to implement an interactive dynamic single Linked List structure. This List will be based on
the node definition given on the next page. Since you already know how to create classes, this
should be a logical extension. Your goal is to create a Linked List class which contains "node"
elements. Your program should contain the ability to dynamically (meaning the user can select what
each choice at anytime):
1. Insert at head (new node at head)
2. Insert at tail (new node placed at the end of the list)
3. Print (prints out the contents of the list in order)
4. Remove from head (remove first node) [watch special case]]
5. Remove from tail (remove last node) [watch special cases]
6. Find a target value (an isThere routine) (tells you if the target is in the list)
7. Give total # of occurrences of a specified value (how many items of target are in the list)
8. Give a total # of nodes (total items in list)
This program will track integers from the user. Be aware that some of these methods above will
force you to create other routines/methods. You are coding dynamic structures - code accordingly.
See page 2 for moro specificity on the methods.
Deliverables:
1) Clearly documented, professionally written source code (in a running form)
2) 3 runs showing all the user menu items. (output) (screenshots are fine)
3) Grading is based on:
a) Meets all requirements (80%)
b) Quality of sourco code (comments, logic, pre/post conditions, etc.) (20%)
For extra credit, you may do the following: (will require research on your own)
[DO NOT DO THIS UNLESS YOUR PROGRAM ALREADY FULLY WORKS]
1) Upgrade the "insert" method to allow for a "variable location insert". (this isn't easy) (5%)
2) Attempt to make 1 or more of the methods recursive. (5%)
Transcribed Image Text:You are to implement an interactive dynamic single Linked List structure. This List will be based on the node definition given on the next page. Since you already know how to create classes, this should be a logical extension. Your goal is to create a Linked List class which contains "node" elements. Your program should contain the ability to dynamically (meaning the user can select what each choice at anytime): 1. Insert at head (new node at head) 2. Insert at tail (new node placed at the end of the list) 3. Print (prints out the contents of the list in order) 4. Remove from head (remove first node) [watch special case]] 5. Remove from tail (remove last node) [watch special cases] 6. Find a target value (an isThere routine) (tells you if the target is in the list) 7. Give total # of occurrences of a specified value (how many items of target are in the list) 8. Give a total # of nodes (total items in list) This program will track integers from the user. Be aware that some of these methods above will force you to create other routines/methods. You are coding dynamic structures - code accordingly. See page 2 for moro specificity on the methods. Deliverables: 1) Clearly documented, professionally written source code (in a running form) 2) 3 runs showing all the user menu items. (output) (screenshots are fine) 3) Grading is based on: a) Meets all requirements (80%) b) Quality of sourco code (comments, logic, pre/post conditions, etc.) (20%) For extra credit, you may do the following: (will require research on your own) [DO NOT DO THIS UNLESS YOUR PROGRAM ALREADY FULLY WORKS] 1) Upgrade the "insert" method to allow for a "variable location insert". (this isn't easy) (5%) 2) Attempt to make 1 or more of the methods recursive. (5%)
Specifics:
1) Your submission (source code):
a. For this project, you may keep your class definition in the same file as the driver -
however, you need to start thinking about importing "packages" – see pages 60-65
in the book.
2) Class construction – my suggestion is to use something similar to the following:
public class Node (
public class Linked_ list {
private int data;
private Node head;
private Node next;
3) DO NOT use any built in "linked list" methods from java. You are to write the code for
"insert", "print", etc. In other words, the logic of how it will be done is to be coded by you.
DO NOT import in any classes or methods from any other source - you need to code this
yourself. If you aren't sure what I mean, ask before you codel
4) You may use (import) standard io methods (get inputs from the user, write to screen, etc.)
as well as methods to do basic error checking (e.g, an islnteger type method)
5) Class methods - node. Much of this is already given to you in chapter 4- you do not have
to put in all the methods that the book shows - just include the ones that you need to fulfill
the requirements. Start with the node class definitions first. Make sure they work before
you move onto the Linked List class. Remember, when you designing this class, think
about how it will be accessed by the Linked list class.
6) The linked list class is a simple extension of the node class; essentially just a head pointer.
Remember, when you design this class, think about how the main (driver) program will
access this class, and how this class will access the node methods.
7) Don't duplicate work done by the node class in the linked list classl In many cases, the
linked list could simply call the Node methods and pass data. Use common sense
constructors and methods - include an empty case constructor as well as a 1 variable
constructor. At this point you DO NOT need to do all the traditional "sets" and "gets" -
BUT, some of them will be needed to do this program.
8) Ultimately, you should end up with 3 "classes"; a node class, a linkedlist class, and the
main (follow class requirements on naming conventions). Although you can have all three
in the same file, you may want to separate them (a node file, linked list file, and of course
your driver or main file). You will be able to reuse some of this code for future
programming assignments so modularity now will help you out a lot later.
9) Your program should present the "user" a menu of choices (i.e. the "abilities" list on the first
page). Ensure you do basic error checking in inputs, AND, think through the logic on empty
cases or special cases; ie. do NOT let the user crash your program by a series of random
inputs.
Transcribed Image Text:Specifics: 1) Your submission (source code): a. For this project, you may keep your class definition in the same file as the driver - however, you need to start thinking about importing "packages" – see pages 60-65 in the book. 2) Class construction – my suggestion is to use something similar to the following: public class Node ( public class Linked_ list { private int data; private Node head; private Node next; 3) DO NOT use any built in "linked list" methods from java. You are to write the code for "insert", "print", etc. In other words, the logic of how it will be done is to be coded by you. DO NOT import in any classes or methods from any other source - you need to code this yourself. If you aren't sure what I mean, ask before you codel 4) You may use (import) standard io methods (get inputs from the user, write to screen, etc.) as well as methods to do basic error checking (e.g, an islnteger type method) 5) Class methods - node. Much of this is already given to you in chapter 4- you do not have to put in all the methods that the book shows - just include the ones that you need to fulfill the requirements. Start with the node class definitions first. Make sure they work before you move onto the Linked List class. Remember, when you designing this class, think about how it will be accessed by the Linked list class. 6) The linked list class is a simple extension of the node class; essentially just a head pointer. Remember, when you design this class, think about how the main (driver) program will access this class, and how this class will access the node methods. 7) Don't duplicate work done by the node class in the linked list classl In many cases, the linked list could simply call the Node methods and pass data. Use common sense constructors and methods - include an empty case constructor as well as a 1 variable constructor. At this point you DO NOT need to do all the traditional "sets" and "gets" - BUT, some of them will be needed to do this program. 8) Ultimately, you should end up with 3 "classes"; a node class, a linkedlist class, and the main (follow class requirements on naming conventions). Although you can have all three in the same file, you may want to separate them (a node file, linked list file, and of course your driver or main file). You will be able to reuse some of this code for future programming assignments so modularity now will help you out a lot later. 9) Your program should present the "user" a menu of choices (i.e. the "abilities" list on the first page). Ensure you do basic error checking in inputs, AND, think through the logic on empty cases or special cases; ie. do NOT let the user crash your program by a series of random inputs.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Types of Linked List
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education