Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

If this is done within the time limit, I am willing to give bonus points by post

ID: 3556775 • Letter: I

Question

If this is done within the time limit, I am willing to give bonus points by posting another question worth 1500 and giving you those points as well.

PlayerLinkedClass can be found here https://www.dropbox.com/sh/tnltyy0cmi0teo5/AADQ9Ddq8UPW3Vg_5hhLPwGZa

Modify the PlayerLinkedClass to include one more method: that method inserts a new player in the third person of the list, head being the first position. If the list is empty, the method will insert the new player as the head of the list. Be sure to test your method with the appropriate client code

Modify the PlayerLinkedClass to include one more method: that method inserts a new player in the next-to-last position of the list. If the list is empty, the method will insert the new player as the head of the list. Be sure to test your method with the appropriate client code.

Modify the PlayerLinkedClass to include one more method: that method inserts a new player in the last position of the list. For this, you cannot use the tail instance variable. Be sure to test your method with the appropriate client code.

Modify the PlayerLinkedClass to include one more method: that method: that method deletes the second node of the list, if there is one. Be sure to test your methodwith the appropriate client code.

Modify the PlayerLinkedClass to include on more method: that method takes a parameter that represents a game. The method inserts a new player at a position just after the first Player of the list with a game instance variable equal to that game. If there is no such node, then your method should insertat the end of the list. Be sure to test your method with the appropriate client code.

Modify the PlayerLinkedClass to include one more method: a traversal that outputs the players in the list until we reach a player with a given id; that player's data should not be output. Be sure to test your method with the appropriate client code.

Explanation / Answer

/* The PlayerLinkedListTest class
Anderson, Franceschi
*/
package Matt;
public class PlayerLinkedListTest
{
public static void main( String [ ] args )
{
Player p1 = new Player( 1,"Sarah","Mario" );
Player p2 = new Player( 2,"Jin","Golf" );
Player p3 = new Player( 3,"Ajay","Donic" );
Player p4 = new Player( 4,"Ant","Sonic" );
Player p5 = new Player( 5,"Bant","Oops" );
Player p6 = new Player( 6,"Rjay","Alfa" );
Player p7 = new Player( 7,"Sunny","Beta" );
Player p8 = new Player( 8,"Monty","Gama" );
  
System.out.println("initial list");
PlayerLinkedList players = new PlayerLinkedList( );

players.insert( p1 ); // insert in empty list
players.insert( p2 );
players.insert( p3 );
players.insert( p4 );
System.out.println( "Number of items in the list: "
   + players.getNumberOfItems( ) + " " + players.toString( ) );

  
System.out.println("1.Insert third person in the list");
players.insertThird(p5);
System.out.println("---------------------------------------");
System.out.println( "Number of items in the list: "
+ players.getNumberOfItems( ) + " " + players.toString( ) );
  
System.out.println("2.Insert second last person in the list");
players.insertSecondLast(p6);
System.out.println("---------------------------------------");
System.out.println( "Number of items in the list: "
+ players.getNumberOfItems( ) + " " + players.toString( ) );
  
  
System.out.println("3.Insert last person in the list");
players.insertLast(p7);
System.out.println("---------------------------------------");
System.out.println( "Number of items in the list: "
+ players.getNumberOfItems( ) + " " + players.toString( ) );
  
System.out.println("4.Delete second person in the list");
players.deleteSecond();
System.out.println("---------------------------------------");
System.out.println( "Number of items in the list: "
+ players.getNumberOfItems( ) + " " + players.toString( ) );
  
System.out.println("5.Insert After person with the game in the list");
players.inserAfterPlayer(p8, "Golf");
System.out.println("---------------------------------------");
System.out.println( "Number of items in the list: "
+ players.getNumberOfItems( ) + " " + players.toString( ) );
  
System.out.println("6.Traverse till a person reached in the list");
players.traverseToPlayer(6);
  

}
}