132k views
5 votes
Create an application named TestSoccerPlayer that instantiates and displays a SoccerPlayer object. The SoccerPlayer class contains the following properties: Name - The player’s name ( a string) JerseyNum - The player's jersey number (an integer) Goals - Number of goals scored (an integer) Assists - Number of assists (an integer)

2 Answers

3 votes

Final answer:

The subject of this question is Computers and Technology and it is suitable for High School level students. To create the TestSoccerPlayer application, you need to instantiate and display a SoccerPlayer object. The SoccerPlayer class contains properties such as Name (a string), JerseyNum (an integer), Goals (number of goals scored, an integer), and Assists (number of assists, an integer).

Step-by-step explanation:

The subject of this question is Computers and Technology and it is suitable for High School level students.

To create the TestSoccerPlayer application, you need to instantiate and display a SoccerPlayer object. The SoccerPlayer class contains properties such as Name (a string), JerseyNum (an integer), Goals (number of goals scored, an integer), and Assists (number of assists, an integer).

Here's an example of how you can create the application in Java:

public class TestSoccerPlayer {

public static void main(String[] args) {

SoccerPlayer player = new SoccerPlayer();

player.setName("John Doe");

player.setJerseyNum(10);

player.setGoals(5);

player.setAssists(3);

System.out.println("Player Name: " + player.getName());

System.out.println("Jersey Number: " + player.getJerseyNum());

System.out.println("Goals: " + player.getGoals());

System.out.println("Assists: " + player.getAssists());

}

}

Remember to replace the placeholders with appropriate values for the player's name, jersey number, goals, and assists.

User Stephan Klein
by
4.2k points
4 votes

Final answer:

To create an application named TestSoccerPlayer, you will need to define a class called SoccerPlayer with the properties Name, JerseyNum, Goals, and Assists. In your TestSoccerPlayer application, you can create an instance of the SoccerPlayer class and display its properties.

Step-by-step explanation:

To create an application named TestSoccerPlayer, you will need to define a class called SoccerPlayer with the properties Name, JerseyNum, Goals, and Assists. Here is an example:

public class SoccerPlayer {

private String name;
private int jerseyNum;
private int goals;
private int assists;

public SoccerPlayer(String name, int jerseyNum, int goals, int assists) {
this.name = name;
this.jerseyNum = jerseyNum;
this.goals = goals;
this.assists = assists;
}
// Getter and setter methods...
}

In your TestSoccerPlayer application, you can create an instance of the SoccerPlayer class and display its properties. Here is an example:

public class TestSoccerPlayer {

public static void main(String[] args) {
SoccerPlayer player = new SoccerPlayer("John Smith", 10, 5, 3);
System.out.println(player.getName());
System.out.println(player.getJerseyNum());
System.out.println(player.getGoals());
System.out.println(player.getAssists());
}
}
User Sushanth CS
by
3.4k points