Question
Java Write a class called SoccerTeam that creates a randomized roster of players from these lists of positions, numbers, and names: names :Smith, Johnson, Lance,
Java
Write a class called SoccerTeam that creates a randomized roster of players from these lists of positions, numbers, and names:
names :Smith, Johnson, Lance, Todd, McDonald
Numbers: 95,61,6,89,93
Positions: 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 to print out the data for the players
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; } }
Should Print out similar to the following as it's randomized the combination of position number and name
Smith, Number 95, Position: F
Johnson, Number 6, Position: D
Lance, Number 61,Position: G
McDonald, Number 93, Position: F
Todd, Number 89, Position: G
Removing the two highest numbers
Johnson, Number 6, Position: D
Lance, Number 61,Position: G
Todd, Number 89, Position: G
Removing the first name in alphabetical order
Lance, Number 61,Position: G
Todd, Number 89, Position: G
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started