Skip to content
Snippets Groups Projects
Commit dfc96bfc authored by Jan Kožusznik's avatar Jan Kožusznik
Browse files

Add number to tasks.

parent 4c550e93
Branches
...@@ -16,27 +16,29 @@ public class StreamMain { ...@@ -16,27 +16,29 @@ public class StreamMain {
Player player = tournament.getRandomPlayer(); Player player = tournament.getRandomPlayer();
System.out.println(player); System.out.println(player);
System.out.print("Počet zápasů: "); System.out.print("Number of matches: ");
//TODO Show the number of matches played by a given player (using Streams) //TODO 3.a Show the number of matches played by a given player (using Streams)
System.out.print("Vstřeleno gólů: ");
//TODO Show the number of goals scored by a given player (help Streams) System.out.print("Goals scored: ");
//TODO 3.b Show the number of goals scored by a given player (help Streams)
Oponents oponents = new Oponents(tournament.getRandomPlayer(), Oponents oponents = new Oponents(tournament.getRandomPlayer(),
tournament.getRandomPlayer()); tournament.getRandomPlayer());
System.out.println("Statistika vzájemných zápasů:" + oponents); System.out.println("Mutual statistics of oponents:" + oponents);
System.out.print("Zápasy: ");
//TODO List the matches played between the given players (using the stream) System.out.print("Matches: ");
System.out.print("Počet zápasů: "); //TODO 4.a List the matches played between the given players (using the stream)
//TODO Print the number of matches played between the given players (using the stream) System.out.print("Number of mathes: ");
//TODO 4.b Print the number of matches played between the given players (using the stream)
System.out.print("Zápas s největším počtem branek:"); System.out.print("Zápas s největším počtem branek:");
//TODO Show match with the largest total number (sum of both players) scored goals between relevant players (help Streams) //TODO 4.c Show match with the largest total number (sum of both players) scored goals between relevant players (help Streams)
} }
public static void loadTournament() { public static void loadTournament() {
//TODO Load a serialized tournament from a file //TODO 5.b Load a serialized tournament from a file
} }
public static void saveTournament(Tournament tournament) { public static void saveTournament(Tournament tournament) {
//TODO Save the tournament to a file using object serialization. //TODO 5.a Save the tournament to a file using object serialization.
} }
} }
...@@ -9,13 +9,12 @@ public class Tournament { ...@@ -9,13 +9,12 @@ public class Tournament {
private List<Match> matches; private List<Match> matches;
public static Tournament generate() { public static Tournament generate() {
List<Player> players = Collections.emptyList(); // TODO 1.a Generate a list of 10 random players using the stream and then filter so that it does not contain players with the same name
List<Player> players = Collections.emptyList();
// TODO Generate a list of 10 random players using the stream and then filter so that it does not contain players with the same name
// TODO 1.b Use the stream to generate a list of 50 matches between random players (from the list of players) with a random result. Make sure the player does not play with himself.
List<Match> matches = Collections.emptyList(); List<Match> matches = Collections.emptyList();
// TODO Use the stream to generate a list of 50 matches between random players (from the list of players) with a random result. Make sure the player does not play with himself.
return new Tournament(players, matches); return new Tournament(players, matches);
} }
...@@ -45,11 +44,11 @@ public class Tournament { ...@@ -45,11 +44,11 @@ public class Tournament {
builder.append("\n"); builder.append("\n");
builder.append("\n\nPlayers:\n"); builder.append("\n\nPlayers:\n");
// TODO Use the stream to add a listing of all players to the builder. Individual players are separated by a "\ n" character // TODO 2.a Use the stream to add a listing of all players to the builder. Individual players are separated by a "\ n" character
builder.append(/* list of all players */""); builder.append(/* list of all players */"");
builder.append("\n\nMatches:\n"); builder.append("\n\nMatches:\n");
// TODO Use the stream to add a listing of all entries to the builder. Individual matches are separated by a "\ n" character // TODO 2.b Use the stream to add a listing of all entries to the builder. Individual matches are separated by a "\ n" character
builder.append(/* list of all matches */""); builder.append(/* list of all matches */"");
return builder.toString(); return builder.toString();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment