Please write this in java using a GUI Implement a class call

Please write this in java using a GUI

Implement a class called Scores that will maintain the top 10 scores for a multi-player video game and a GUI application that you can use to test the functionality of the Scores class. You must use a linked list. A single linked list is fine. If you want a little extra challenge, you may use a doubly linked list. Your Scores class must have appropriate constructors, a count property for the number of scores currently in the list, methods as needed to add, remove, search, display scores, etc. The list must be ordered with the highest score at the head of the list and lowest high score at the tail of the list. You may have a permanent “dummy node” to anchor the head of the list if you think that will make linking operations easier. In the event of a tie score, the new person/score will replace the older one. For your list nodes, you will create a class called Score that will store a person’s name, their score and a pointer to the next node. If you opt for the double linked list, you’ll also need a pointer to the previous node. Your graphical user interface must contain controls to allow the user to enter a name and score and then add the score to the list assuming the list isn’t full or the score is higher than (or at least ties) another score in the list. You will also need a list box control to display the contents. In the event a player is found to be cheating, you’ll need a method to find their name in the scores list and remove their score node.
Please write this in java using a GUI

Implement a class called Scores that will maintain the top 10 scores for a multi-player video game and a GUI application that you can use to test the functionality of the Scores class. You must use a linked list. A single linked list is fine. If you want a little extra challenge, you may use a doubly linked list. Your Scores class must have appropriate constructors, a count property for the number of scores currently in the list, methods as needed to add, remove, search, display scores, etc. The list must be ordered with the highest score at the head of the list and lowest high score at the tail of the list. You may have a permanent “dummy node” to anchor the head of the list if you think that will make linking operations easier. In the event of a tie score, the new person/score will replace the older one. For your list nodes, you will create a class called Score that will store a person’s name, their score and a pointer to the next node. If you opt for the double linked list, you’ll also need a pointer to the previous node. Your graphical user interface must contain controls to allow the user to enter a name and score and then add the score to the list assuming the list isn’t full or the score is higher than (or at least ties) another score in the list. You will also need a list box control to display the contents. In the event a player is found to be cheating, you’ll need a method to find their name in the scores list and remove their score node.
Please write this in java using a GUI

Implement a class called Scores that will maintain the top 10 scores for a multi-player video game and a GUI application that you can use to test the functionality of the Scores class. You must use a linked list. A single linked list is fine. If you want a little extra challenge, you may use a doubly linked list. Your Scores class must have appropriate constructors, a count property for the number of scores currently in the list, methods as needed to add, remove, search, display scores, etc. The list must be ordered with the highest score at the head of the list and lowest high score at the tail of the list. You may have a permanent “dummy node” to anchor the head of the list if you think that will make linking operations easier. In the event of a tie score, the new person/score will replace the older one. For your list nodes, you will create a class called Score that will store a person’s name, their score and a pointer to the next node. If you opt for the double linked list, you’ll also need a pointer to the previous node. Your graphical user interface must contain controls to allow the user to enter a name and score and then add the score to the list assuming the list isn’t full or the score is higher than (or at least ties) another score in the list. You will also need a list box control to display the contents. In the event a player is found to be cheating, you’ll need a method to find their name in the scores list and remove their score node.

Solution

public class Node<V>
{
// instance variables
private V element;
private Node<V> next;

  
public Node()
{
this (null, null);
}
  
public Node(V element, Node<V> next)
{
this.element = element;
this.next = next;
}

// set/get methods
public V getElement()
{
return element;
}
public Node<V> getNext()
{
return next;
}
public void setElement(V element)
{
this.element = element;
}
public void setNext(Node<V> next)
{
this.next = next;
}

}

public class SLinkedList<V>
{
// instance variables. Add the tail reference.
protected Node<V> head, tail;
protected long size;

// methods, empty list constructor first
public SLinkedList ()
{
head = null;
tail = null;
size = 0;
}

// method to add nodes to the list.
public void addFirst (Node<V> node)
{
// set the tail only if this is the very first node
if (tail == null)
tail = node;
node.setNext (head); // make next of the new node refer to the head
head = node; // give head a new value
size++;
}

// addAfter - add new node after current node, checking to see if we are at the tail
public void addAfter (Node<V>currentNode, Node<V>newNode)
{
if (currentNode == tail)
tail = newNode;
newNode.setNext (currentNode.getNext ());
currentNode.setNext (newNode);
size++;
}

// addLast - add new node after the tail node.
public void addLast (Node<V> node)
{
node.setNext (null);
tail.setNext (node);
tail = node;
size++;   
}

// methods to remove nodes from the list.
public Node<V> removeFirst ()
{
if (head == null)
System.err.println(\"Error: List is empty\");

// save the one to return
Node<V> temp = head;

// do reference manipulation
head = head.getNext ();
temp.setNext(null);
size--;

return temp;

}
  
public Node<V> removeLast ()
{
// // declare local variables/objects
Node<V> nodeBefore;
Node<V> nodeToRemove;

// make sure we have something to remove
if (size == 0)
System.err.println(\"Error: Attempt to remove fron an empty list\");

// traverse through the list, getting a reference to the node before
// the trailer. Since there is no previous reference.
nodeBefore = getFirst ();

// potential error ?? See an analysis and drawing that indicates the number of iterations
// 9/21/10. size - 2 to account for the head and tail nodes. We want to refer to the one before the
// tail.
for (int count = 0; count < size - 2; count++)
nodeBefore = nodeBefore.getNext ();

// save the last node
nodeToRemove = tail;

// now, do the pointer manipulation
nodeBefore.setNext (null);
tail = nodeBefore;
size--;

return nodeToRemove;

}

// method remove. Remove a known node from the list.
public void remove (Node<V> nodeToRemove)
{
// declare local variables/references
Node<V> nodeBefore, currentNode;

// make sure we have something to remove
if (size == 0)
System.err.println(\"Error: Attempt to remove fron an empty list\");

// starting at the beginning check for removal
currentNode = getFirst ();
if (currentNode == nodeToRemove)
removeFirst();
currentNode = getLast ();
if (currentNode == nodeToRemove)
removeLast();

// we\'ve already check two nodes, check the rest
if (size - 2 > 0) {
nodeBefore = getFirst ();
currentNode = getFirst ().getNext ();
for (int count = 0; count < size - 2; count++) {
if (currentNode == nodeToRemove) {
// remove current node
nodeBefore.setNext (currentNode.getNext ());
size--;
break;
}

// change references
nodeBefore = currentNode;
currentNode = currentNode.getNext ();
}
}
}

// the gets to return the head and/or tail nodes and size of the list
public Node<V> getFirst () { return head; }
public Node<V> getLast () { return tail; }
public long getSize () { return size; }

}

public class GameScores
{
protected String name; // name of the person earning this score
protected int score; // the score value
/** Constructor to create a game entry */
public GameScores(String name, int score)
{
this.name = name;
this.score = score;
}
/** Retrieves the name field */
public String getName()
{
return name;
}
/** Retrieves the score field */
public int getScore()
{
return score;
}
/** Returns a string representation of this entry */
public String toString()
{
return \"(\" + name + \", \" + score + \")\";
}
  
}

public class GameScores
{
protected String name; // name of the person earning this score
protected int score; // the score value
/** Constructor to create a game entry */
public GameScores(String name, int score)
{
this.name = name;
this.score = score;
}
/** Retrieves the name field */
public String getName()
{
return name;
}
/** Retrieves the score field */
public int getScore()
{
return score;
}
/** Returns a string representation of this entry */
public String toString()
{
return \"(\" + name + \", \" + score + \")\";
}
  
}


public class GameTester
{
public static void main(String[] args)
{
GameScores entry;
entry = new GameScores(\"Anna\", 600);   
entry = new GameScores(\"Paul\", 720);
System.out.println(\"TOP GAME SCORES\");

}
  
}

public class Scores
{
//add function
public SLinkedList<GameScores> add(GameScores rank, SLinkedList<GameScores> scores)
{
Node<GameScores> currentNode = scores.getFirst();
Node<GameScores> nextNode = null;
Node<GameScores> previousNode = null;
Node<GameScores> newNode = new Node<GameScores>();
newNode.setElement(rank);

if(scores.getSize() == 0)
{
scores.addFirst(newNode);
}
else
{
while(currentNode != null)
{   
nextNode = currentNode.getNext();
if(nextNode == null)
{
scores.addLast(newNode);
}
else
{
scores.addAfter(currentNode, newNode);
break;
}   
previousNode = currentNode;
currentNode = currentNode.getNext();
}
}
return scores;
}

//remove function
public void remove(int i)
{

}

public void print(SLinkedList<GameScores> scores)
{
Node<GameScores> currentNode = scores.getFirst();
GameScores currentEntry = currentNode.getElement();
System.out.printf(\"[\");
for(int i = 0; i < scores.getSize(); i++)
{
System.out.printf(\", %s\", currentEntry.toString());
currentNode = currentNode.getNext();
currentEntry = currentNode.getElement();
}
System.out.println(\"]\");
}
}

 Please write this in java using a GUI Implement a class called Scores that will maintain the top 10 scores for a multi-player video game and a GUI application
 Please write this in java using a GUI Implement a class called Scores that will maintain the top 10 scores for a multi-player video game and a GUI application
 Please write this in java using a GUI Implement a class called Scores that will maintain the top 10 scores for a multi-player video game and a GUI application
 Please write this in java using a GUI Implement a class called Scores that will maintain the top 10 scores for a multi-player video game and a GUI application
 Please write this in java using a GUI Implement a class called Scores that will maintain the top 10 scores for a multi-player video game and a GUI application
 Please write this in java using a GUI Implement a class called Scores that will maintain the top 10 scores for a multi-player video game and a GUI application

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site