Question: ontent-rid-27637315 1/courses/FA18-CPSC-50100-X/CPSC501 Program4.pdf 1/3 CPSC 501: Programming Fundamentals Programming Assignment 4-Set ADT For this assignment, you are to write a program which implements a Set
ontent-rid-27637315 1/courses/FA18-CPSC-50100-X/CPSC501 Program4.pdf 1/3 CPSC 501: Programming Fundamentals Programming Assignment 4-Set ADT For this assignment, you are to write a program which implements a Set data structure using a singly linked list implementation and a driver program that will test this implementation. The Set ADT is a linear collection of data that will support the following operations: 1. add (x) - adds the integer x to the collection. The resulting collection should not contain any duplicate values. 2. delete(x) - deletes the integer x from the set. 3. exists (x) -returns true if the integer x exists in the set and false otherwise. 4. tostring() -returns a string representing the set as a space separated list The time complexity of all operations should be O(N), where N is the size of the collection. Program Design Requirements . Your program should consist of 3 classes: LinkedNode, Set, and Test 2. The Test class is the driver class for your program (should contain only the main method). Inside the main method, you should create a new Set object, then enter an infinite loop in which the user is prompted to enter one of 3 commands: add x del x exists x x stands for an actual number (some integer). The add and delete operations should perform the necessary operation (inserting or deleting the given integer) and then display the contents of the set using the tostring() method. The exists command should output true or false depending on whether x exists in the set. 3. The Set class should implement the Set ADT by adding the appropriate variables and 4. The LinkedNode class should contain an integer value and a pointer to the next 5. Make sure to validate all inputs. This means re-prompting the user if he or she entered methods. There should be I method for each of the required operations. LinkedNode something invalid. Additional Requirements 1. Your code should follow good coding practices, including good use of whitespace 2. You need to use meaningful identifier names that conform to standard Java naming 3. At the top of each file, you need to put a block comment with the following information (indents and line breaks) and use of both inline and block comments. conventions, your name, course name, semester, and assignment name 4. The output of your program should match exactly the sample program output given
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
