65 lines
1.6 KiB
Java
65 lines
1.6 KiB
Java
import java.util.Arrays;
|
|
import java.util.Random;
|
|
|
|
public class PremierLeaguePlayer {
|
|
private int[] goalsInMatches;
|
|
private int minutesPlayed;
|
|
private int[] minutesOfGoals;
|
|
private int totalPasses;
|
|
private int matchesPlayed;
|
|
private int totalGoals;
|
|
private String position;
|
|
|
|
public PremierLeaguePlayer(int numberOfMatches, String position) {
|
|
Random random = new Random();
|
|
|
|
this.goalsInMatches = new int[numberOfMatches];
|
|
for (int i = 0; i < numberOfMatches; i++) {
|
|
this.goalsInMatches[i] = random.nextInt(5);
|
|
}
|
|
|
|
this.minutesPlayed = random.nextInt(90 * numberOfMatches);
|
|
|
|
this.minutesOfGoals = new int[numberOfMatches];
|
|
for (int i = 0; i < numberOfMatches; i++) {
|
|
if(this.goalsInMatches[i] > 0) {
|
|
this.minutesOfGoals[i] = random.nextInt(91);
|
|
}
|
|
}
|
|
|
|
this.totalPasses = random.nextInt(250 * numberOfMatches);
|
|
this.matchesPlayed = numberOfMatches;
|
|
this.totalGoals = Arrays.stream(this.goalsInMatches).sum();
|
|
this.position = position;
|
|
}
|
|
|
|
public int getMatchesPlayed() {
|
|
return matchesPlayed;
|
|
}
|
|
|
|
public int getMinutesPlayed() {
|
|
return minutesPlayed;
|
|
}
|
|
|
|
public int getTotalGoals() {
|
|
return totalGoals;
|
|
}
|
|
|
|
public int getTotalPasses() {
|
|
return totalPasses;
|
|
}
|
|
|
|
public int[] getGoalsInMatches() {
|
|
return goalsInMatches;
|
|
}
|
|
|
|
public int[] getMinutesOfGoals() {
|
|
return minutesOfGoals;
|
|
}
|
|
|
|
public String getPosition() {
|
|
return position;
|
|
}
|
|
|
|
}
|