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

Assignment: Write a program that consists of the classes listed below. Player Cl

ID: 3630172 • Letter: A

Question

Assignment: Write a program that consists of the classes listed below.
Player Class: The Player Class consists of player name. Include in the class appropriate accessor and mutator methods for each element in the class. You may have other attributes if needed.
Team Class: The Team class consists of at least 2 elements -- the name of the team and a collection of players from the Player class. Include in the class appropriate accessor and mutator methods for each element in the class. You may have other attributes if needed.
Input3 class: The Input3 class is provided for you. The Input3 class supplies data for your program. The Input3 class has a public method, called getNextString, which returns a string with the input for your program, one after the other. You must use this class to get the data for your program. Your program should be written in such a manner that the grader could utilize an Input3 class with different numbers of teams and players and still give correct output according to the data supplied.

The input 3 is provided below:
/** Input.java */
public class Input3
{
private String[] input = new String[40];
private static int StringNum = -1;
public static final int NUMBER_OF_TEAMS = 3;
public static final int NUMBER_OF_PLAYERS = 5;

public Input3()
{
//The first six inputs will be for the first team
input[0] = "LAKERS";
input[1] = "Kobe Bryant";
input[2] = "Derek Fisher";
input[3] = "Shaquille O'Neal";
input[4] = "Karl Malone";
input[5] = "Brian Cook";

//The next six inputs will be for the second team
input[6] = "MAVERICKS";
input[7] = "Antoine Walker";
input[8] = "Dirk Nowitzki";
input[9] = "Tony Delk";
input[10] = "Shawn Bradley";
input[11] = "Travis Best";

//The next six inputs will be for the third team
input[12] = "KNICKS";
input[13] = "Mike Sweetney";
input[14] = "Allan Houston";
input[15] = "Howard Eisley";
input[16] = "Kurt Thomas";
input[17] = "Shanon Anderson";


}

//This method returns the strings one after the other.

public String getNextString()
{
StringNum++;
return input[StringNum];

}


}

Explanation / Answer

public class Player { private String name; Player(String name){ this.name = name; } public String getName(){ return name; } public String toString(){ return name+" "; } } ////////////////////////////////////////////////////////////////////////// public class Team { private String teamName; private Player[] players; private int pointer = 0; Team(String teamName, int teamSize){ this.teamName = teamName; this.players = new Player[teamSize]; } public void addPlayer(String name){ players[pointer++] = new Player(name); } public String toString(){ String returnString = ""; returnString += teamName + " "; for (int i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote