Question: Java Write a class called SoccerTeam that creates a randomized roster of players from these lists of positions, numbers, and names: Smith, Johnson, Lance, Todd,

Java

Write a class called SoccerTeam that creates a randomized roster of players from these lists of positions, numbers, and names:

Smith, Johnson, Lance, Todd, McDonald

95,61,6,89,93

F,D,G

Cannot repeat numbers and names but can repeat positions

You need to set your positions, names, numbers in a function you can't use a different variable for each part such as names, positions, numbers.

Create the roster have it print then remove all players with a number higher then 89 and print. Then make it remove the person with the first name alphabetically then print.

Use Player.java

You need to use the code as shown and cannot change it in any way.

public class Player { String surname; char position; int number; public Player(String s, char p, int n) { surname = s; position = p; number = n; } public void setSurname(String s){surname = s;} public void setPosition(char p){position = p;} public void setNumber(int n){number = n;} public String getSurname(){return surname;} public char getPosition(){return position;} public int getNumber(){return number;} public String toString() { return surname + ", Number " + number + ", Position: " + position; } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!