Programming

Hey guys, I seem to be having a bit of trouble with my assignement involving linked lists in java. The problem is with creating the node. My professor asks that we create a string and int in the node, but all examples that I have found only use one node. Heres the assignment: In addition to linked lists, you will demonstrate your understanding of many components discussed this semester including inheritance. Everyone must use inheritance to create a linked list class and an application that tracks the name and score of the top 10 gamers using the linked list class. Duplicate entries are allowed in the list. Only the top 10 scores will be maintained. When the list contains 10 entries and a new entry is attempted, the application should only add the new entry if the score exceeds the lowest score on the list. In that case, the lowest score currently on the list should be dropped. Java defines a LinkedList class in java.util. Your GameLinkedList class should extend this class and implement the GameLinkedListInterface (click link to download the interface.) Eligible points for this project are based upon the items completed. All projects must extend the java.util.LinkedList class and implement the GameLinkedListInterface (option 1). Option Items Completed Percentage of the available points 1 Node, GameLinkedList 70% 2 Exception Handling using exception classes + 15% 3 GUI client + 15% For those not completing Option 3, a keyboard/monitor client is required. Classes: Node class The Node class should define a single name, score, and the next Node object in the Linked List. All Node objects must contain a non-blank name and a score greater than zero. Options •(Option 1) Display an error message to System.err object whenever an illegal name or illegal score is encountered. •(Option 2) The class should throw a IllegalDataFieldException exception (see below) whenever an illegal name or illegal score is encountered. GameLinkedList class A customized version of the java.util.LinkedList class, the GameLinkedList class should maintain an ordered linked list of Node objects. The class must implement the GameLinkedListInterface. The class will be responsible for creating new Node objects and adding them to the list when space is available. When the list is full and the new Node's score is greater than the lowest score, the Node containing the lowest score should be removed from the list. Options •(Option 1) Display an error message to System.err object whenever a new Node can not be added to the list. Remove the comment from the applicable add method described in the GameLinkedListInterface. •(Option 2) The class should throw a LinkedListException exception (see below) when a Node can not be created due to illegal data. The exception should also be thrown when the list is full and the score to be added is less than the lowest score on the list. Remove the comment from the applicable add method described in the GameLinkedListInterface. Exception classes (Option 2 only) Two exception classes are required, one for Node errors and one for LinkedList errors to respond to the following: •The IllegalDataFieldException class reports Node errors to the LinkedList class ◦null or blank name ◦score less than 0 •The LinkedListException class reports Linked List errors to the client ◦unsuccessful add due to a Node error or a full list Client Application: The client is responsible for retrieving a new name and score entry from the user, sending the information to the Linked List for addition, and displaying the current content of the Link List class. Options •(Option 1) The client should utilize the keyboard and monitor. Individual classes are responsible for error reporting. •(Option 2) The client should utilize the keyboard and monitor. The client is also responsible for displaying any errors that occur during processing. •(Option 3) Implement the client using a simple GUI interface such as the one shown below. When option 2 is also completed, error reporting should be displayed in the window. Hints: The Linked List must be maintained in score order. Therefore, the Node containing the lowest score will be at one end of the list or the other. Before developing the add method, take into consideration the removeLowest method (is it easier to remove a node from the beginning or the end?) When completing option three, keep it simple. A JTextArea and the GameLinkedList toString method can be used to display the list. Since the data is being managed by the GameLinkedList class, there is no need for JPanel classes. Read the lab specifications again. There is not a lot of coding! Plus, by completing all three options, you will have reviewed a substantial amount of the material covered on the Final exam ;) Evaluation: Classes must compile without syntax errors or will not be evaluated. This lab is worth 30 points. All class should be implemented as outlined above and must adhere to the style guide. Points will be distributed as follows: •Node class (4 points) •LinkedList class (15 points) •IllegalDataFieldException and IllegalLinkedListException classes (4.5 points) •Client application (2 points) or GUI client application (6.5 points) •On time (late penalty of 10 points assessed for projects submitted late) Here is the node code so far: import java.util.LinkedList; public class Node { private String name; private int score; private Node next; public Node() { name = null; score = 0; next = null; } public Node(String nam, int sco) throws IllegalDataFieldException { if (nam == null || sco < 0) throw new IllegalDataFieldException("No name entered or negative score posted"); else { name = nam; score = sco; } next = null; } public void setName(String nam) { name = nam; } public String getName() { return name; } public void setScore(int sco) { score = sco; } public int getScore() { return score; } public void setNext(Node n) { next = n; } public Node getNext() { return next; } }

Answers

won below. The client is responsible for displaying any errors that occur during processing. My main question is how do I go about creating my node class with 2 strings while still being able to implement the interface without being static since static methods and fields cannot be overridden. I try to use the get and set methods to get around this, but I'm still unsure if its working correctly and I'm not recieving any feedback on the assignment. I would really appreciate any help; thank you in advance!

Answered by jrowland

We have mentors from

Contact support