CS 101 – Algorithms & Programming I Solved

$ 29.99
Category:

Description

For all labs, your solutions must conform to the CS101 style guidelines!
All data and results should be stored in variables (or constants where appropriate) with meaningful names.
The objective of this lab is to learn how to use Arrays and ArrayLists. An array is a container object that holds a fixed number of values of a single type. When you need an array-like data structure that offers dynamic resizing, you would usually use an ArrayList. An ArrayList is an array that resizes itself as needed. Remember that analyzing your problems and designing them on a piece of paper before starting implementation/coding is always a best practice.
0. Setup Workspace
Start VSC and open the previously created workspace named labs_ws. Now, under the labs folder, create a new folder named lab9.
In this lab, you are to have five Java classes/files (under labs/lab9 folder) as described below. A sixth Java file containing the revision should go under this folder as well. We expect you to submit 6 files, including the revision, without compressing them. Do not upload other/previous lab solutions in your submission. Outputs of sample runs are shown as brown whereas the user inputs are shown in blue color.
1. Player Class
Create a new/empty file to define a class named Player. This class defines the details of a football player in the application.
Instance Data Members:
– name: The name of the player (String)
– age: The age of the player (int)
– nationality: The nationality of the player (String)
– jerseyNumber: The jersey number of the player (int)
– position: The position of the player (String)
– marketValue: The current market value of the player (int)
Methods:
– Constructor:
– Creates the player to be used.
– Takes name, age, nationality, jerseyNumber, position, and marketValue. There are restrictions where age and marketValue must be positive, and jerseyNumber must be between 1 and 99, inclusive.
– Initializes the data members name, age, nationality,jerseyNumber, position, marketValue.
– Accessor methods:
– You need to implement methods to access the data variables name, age, nationality, jerseyNumber, position, marketValue of the player.
– Setter methods:
– setAge: Sets the player’s age if the age is positive.
– setJerseyNumber: Sets the jersey number of the player. Jerseys are numbered between 1 and 99, inclusive.
– setPosition: Changes the position of a player.
– setMarketValue: Changes the market value of a player if the value is positive.
– toString method
– Override the toString method to get an understandable string representation of a player object, showing the player’s name, age, nationality, jersey number, position, and market value.
Sample run:
Player p = new Player(“Raheem Sterling”, 27,”England”, 17, “Left Wing”, 70000000)); System.out.println(p);
Raheem Sterling 27 England 17 Left Wing 70,000,000
2. Team Class
Create a new/empty file to define a class named Team. This class defines the details of a team in the application.
Instance Data Members:
– ID: The ID of the team (int)
– name: The name of the team (String)
– averageAge: The average age of the team (int)
– marketValue: The total market value of the team (int)
– squad: ArrayList of Player objects (ArrayList)
Methods:
– Constructor:
– Registers the team to the system.
– Takes ID and name, where ID must be positive.
– Initializes the data members ID, name, averageAge, marketValue, and squad.
– Accessor methods:
– You need to implement methods to access the data variables ID, name, averageAge, and marketValue.
– Team methods:
– playerExists : returns true if a player with a specific jersey number exists in the team.
– addPlayer : takes a Player object as parameter and adds this player to the team if the player does not exist in the team and the player is a citizen of that country
– removePlayer: removes the player from the team with the specific jersey number
– toString: Override the toString method to return an informative representation of the team including team ID, name, average age, total market value, and players in the team.
Sample output for a Team object:
Team turkiye = new Team(38, “Türkiye”);
Player p1 = new Player(“Altay Bayindir”,24, “Türkiye”, 1, “Goalkeeper”, 13000000); Player p2 = new Player(“Çaglar Söyüncü”,26, “Türkiye”, 4, “Centre Back”, 22000000); turkiye.addPlayer(p1); turkiye.addPlayer(p2);
System.out.println(turkiye);
=================================================================================
= Team Details = =================================================================================
ID: 38
Team: Türkiye
Average Age: 25
Market Value: 35,000,000
Squad is composed of following players:
——————————————————————————–Name Age Nationality Number Position Market Value
———————————————————————————
Altay Bayindir 24 Türkiye 1 Goalkeeper 13,000,000
Çaglar Söyüncü 26 Türkiye 4 Centre Back 22,000,000
=================================================================================
3. Game Class
Your next task is to create a new/empty file to define a class named Game that defines the details of a game/match in the application.
Instance Data Members:
– teams: Array of Team objects playing the game (Array)
– goals: Array of integers indicating the goals scored by respective teams (Array)
Methods:
– Constructor:
– Registers the game to the system.
– Takes team1, team2, team1Goals, and team2Goals, where goals must be positive and teams must exist.
– Initializes the data members teams and goals.
– Accessor methods:
– You need to implement a method to access the data variable teams.
– Game methods:
– getTeamPoints: returns the points obtained from this game for a given team with its team ID.
– toString: Override the toString method to return an informative representation of the game, including team names and the goals of the respective teams.
Sample output for a Game object:
Team germany = new Team(6, “Germany”);
Team turkiye = new Team(38, “Türkiye”);
Game g1 = new Game(turkiye, germany, 3, 2);
System.out.println(g1);
Türkiye vs. Germany: 3-2
4. Group Class
Create a new/empty file to define a class named Group. This class defines the details of a group in the world cup qualifiers.
Instance Data Members:
– name: The name of the group (String)
– groupSize: The size of the group (int)
– numberOfTeams: The number of teams currently added to the group (int)
– teams: Array of Team objects playing the game (Array)
– games: Array of {Array of Game objects} indicating the games played between teams in the group ( 2D Array)
– points: Array of points received (Array)
Methods:
– Constructor:
– Registers the group to the system.
– Takes a name and a positive groupSize.
– Initializes the data members name, groupSize, numberOfTeams, teams, games, and points.
– Accessor methods:
– You need to implement methods to access the data variables name, groupSize, and numberOfTeams.
– Group methods:
– teamExists : returns true if the team with the given ID exists in the group
– addTeam: adds a team to the group if the team does not already exist in the group and there is room in the group
– addGame: adds a game to the group by updating the individual team game properties in the group captured by the games data member. The game is added only if both teams of the game belong to the same group. Furthermore, we assume that there is only one game between the teams (there is no concept of Home vs. Visitor in the world cup). Additional games added between the same teams will be ignored. When the game is added, points for the teams are updated accordingly.
– toString: Override the toString method to return an informative representation of the group, which displays the standings within the group according to the points so far.
Sample output for a Group object:
Group B = new Group(“B”, 3);
Team germany = new Team(6, “Germany”);
Team turkiye = new Team(38, “Türkiye”);
Team england = new Team(34, “England”);
B.addTeam(england); B.addTeam(germany);
B.addTeam(turkiye);
Game g1 = new Game(turkiye, germany, 3, 3);
Game g2 = new Game(turkiye, england, 2, 0);
B.addGame(g2);
B.addGame(g1);
System.out.println(B);
==================================
= Group B Standings =
==================================
1. Germany ( 6 ) 4 2. England ( 34 ) 1
3. Türkiye ( 38 ) 0
==================================

5. Main Class
Download the Java class provided to you with the Qatar22 name. This class already defines the three teams with players for you, namely, Türkiye, England, and Germany. Furthermore, a group with 4 teams is created with these three teams added. Your main method will start with this already-filled data. Then, you will provide a menu for the user to interact with Player, Team, Game, and Group objects. Create the Qatar22 app where user will be able to:
– create a new team,
– display a team,
– add a player to a team,
– remove a player with ID from a team,
– add a game to the group,
– display standings in the group,
– exit the application
Note: You need to check user input for the correctness and perform the modifications and updates if the inputs are valid. For example, if the group is already full, you will not accept adding a new team to the group. Or if a player with a jersey number already is on the team, you should respond to the user indicating that “a player with that jersey number is already in the team.” Users should know what is going on in the application. We have shown only some problematic input cases, but you should consider all possible scenarios. The specific conditions are given in each class for each property. You do not need to check for the correctness of input if it is not specified in the class.
while( there are teams not displayed yet){ find the team that is not displayed yet with the maximum points and display it
}
Sample run (Create a new team):
—————————————————
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 1
What is the unique ID of the Team?: 10
What is the name of the Team?: Brazil
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 6
==================================
= Group A Standings =
==================================
1. Germany ( 6 ) 0 2. England ( 34 ) 0
3. Türkiye ( 38 ) 0
4. Brazil ( 10 ) 0
==================================
Sample run (Create a new team with a full group, first display the group to see it):
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 6
==================================
= Group A Standings =
==================================
1. Germany ( 6 ) 0 2. England ( 34 ) 0 3. Türkiye ( 38 ) 0
4. Brazil ( 10 ) 0
==================================
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 1
Group already has 4/4 teams.
Sample run (Create a new team with a negative ID):
—————————————————
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 1
What is the unique ID of the Team?:-1 Group ID cannot be negative!
Sample run (Display a team):
—————————————————
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 2
What is the unique ID of the Team?: 38
=================================================================================
= Team Details = =================================================================================
ID: 38
Team: Türkiye
Average Age: 24
Market Value: 206,500,000
Squad is composed of following players:
——————————————————————————–Name Age Nationality Number Position Market Value
———————————————————————————
Ugurcan Çakir 26 Türkiye 23 Goalkeeper 14,000,000
Altay Bayindir 24 Türkiye 1 Goalkeeper 13,000,000
Çaglar Söyüncü 26 Türkiye 4 Centre Back 22,000,000
Ozan Kabak 22 Türkiye 15 Centre Back 10,000,000
Tayyip Sanuç 22 Türkiye 6 Centre Back 3,800,000
Eren Elmali 22 Türkiye 13 Left Back 4,200,000
Zeki Çelik 25 Türkiye 2 Right Back 15,000,000
Salih Özcan 24 Türkiye 5 Defensive Midfield 17,000,000
Hakan Çalhanoglu 28 Türkiye 10 Central Midfield 35,000,000
Arda Güler 17 Türkiye 25 Attacking Midfield 10,000,000
Kerem Aktürkoglu 24 Türkiye 7 Left Wing 13,000,000
Cengiz Ünder 25 Türkiye 17 Right Wing 17,000,000
Enes Ünal 25 Türkiye 16 Centre Forward 25,000,000
Umut Bozok 26 Türkiye 19 Centre Forward 5,500,000
Cenk Tosun 31 Türkiye 9 Centre Forward 2,000,000
=================================================================================
Sample run (Display a team with negative ID):
—————————————————
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 2
What is the unique ID of the Team?: -1 Team ID cannot be negative!
Sample run (Display a team that does not exist, first display the group to see which teams are already in the group):
—————————————————
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 6
==================================
= Group A Standings =
==================================
1. Germany ( 6 ) 0 2. England ( 34 ) 0
3. Türkiye ( 38 ) 0
==================================
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————Your choice: 2
What is the unique ID of the Team?: 12 Team does not exist!
Sample run (Add a player to a team):
—————————————————
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 2
What is the unique ID of the Team?: 6
=================================================================================
= Team Details = =================================================================================
ID: 6
Team: Germany
Average Age: 26
Market Value: 654,000,000
Squad is composed of following players:
——————————————————————————–Name Age Nationality Number Position Market Value
———————————————————————————
Andre Ter Stegen 30 Germany 22 Goalkeeper 30,000,000
Manuel Neuer 36 Germany 1 Goalkeeper 12,000,000
Antonio Rüdiger 29 Germany 2 Centre Back 40,000,000
Niklas Süle 27 Germany 15 Centre Back 35,000,000
Thilo Kehrer 26 Germany 5 Centre Back 22,000,000
David Raum 24 Germany 3 Left Back 26,000,000
Lukas Klostermann 26 Germany 16 Right Back 14,000,000
Joshua Kimmich 27 Germany 6 Defensive Midfield 80,000,000
Leon Goretzka 27 Germany 8 Central Midfield 65,000,000
Ilkay Gündogan 32 Germany 21 Central Midfield 25,000,000
Jamal Musiala 19 Germany 14 Attacking Midfield 100,000,000

Leroy Sane 26 Germany 19 Left Wing 70,000,000
Serge Gnabry 27 Germany 10 Right Wing 65,000,000
Karim Adeyemi 20 Germany 24 Right Wing 35,000,000
Youssoufa Moukoko 18 Germany 26 Centre Forward 30,000,000
Niclas Füllkrug 29 Germany 9 Centre Forward 5,000,000
=================================================================================
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 3
What is the unique ID of the Team to add the Player?: 6
Enter the name of the player: Mesut Ozil
Enter the age of the player: 34
Enter the nationality of the player: Germany
Enter the jersey number of the player: 20
Enter the position of the player: Attacking Midfield
Enter the market value of the player: 1000000
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 2
What is the unique ID of the Team?: 6
=================================================================================
= Team Details = =================================================================================
ID: 6
Team: Germany
Average Age: 26
Market Value: 655,000,000
Squad is composed of following players:
——————————————————————————–Name Age Nationality Number Position Market Value
———————————————————————————
Andre Ter Stegen 30 Germany 22 Goalkeeper 30,000,000
Manuel Neuer 36 Germany 1 Goalkeeper 12,000,000
Antonio Rüdiger 29 Germany 2 Centre Back 40,000,000
Niklas Süle 27 Germany 15 Centre Back 35,000,000
Thilo Kehrer 26 Germany 5 Centre Back 22,000,000
David Raum 24 Germany 3 Left Back 26,000,000
Lukas Klostermann 26 Germany 16 Right Back 14,000,000
Joshua Kimmich 27 Germany 6 Defensive Midfield 80,000,000
Leon Goretzka 27 Germany 8 Central Midfield 65,000,000
Ilkay Gündogan 32 Germany 21 Central Midfield 25,000,000
Jamal Musiala 19 Germany 14 Attacking Midfield 100,000,000
Leroy Sane 26 Germany 19 Left Wing 70,000,000
Serge Gnabry 27 Germany 10 Right Wing 65,000,000
Karim Adeyemi 20 Germany 24 Right Wing 35,000,000
Youssoufa Moukoko 18 Germany 26 Centre Forward 30,000,000
Niclas Füllkrug 29 Germany 9 Centre Forward 5,000,000
Mesut Ozil 34 Germany 20 Attacking Midfield 1,000,000
=================================================================================
Sample run (Add a player to a team, Player with the jersey number already exists!):
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 3
What is the unique ID of the Team to add the Player?: 6
Enter the name of the player: Mario Gotze
Enter the age of the player: 30
Enter the nationality of the player: Germany
Enter the jersey number of the player: 20
Player with the jersey number already exists!
Sample run (Add a player to a team, Player must be a citizen of the country!):
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 3
What is the unique ID of the Team to add the Player?: 6
Enter the name of the player: Neymar da Silva Santos Junior
Enter the age of the player: 30
Enter the nationality of the player: Brazil Player must be a citizen of the country!
Sample run (Add a player to a team; market value cannot be negative!):
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 3
What is the unique ID of the Team to add the Player?: 6
Enter the name of the player: Mesut Ozil
Enter the age of the player: 34
Enter the nationality of the player: Germany
Enter the jersey number of the player: 91
Enter the position of the player: Attacking Midfield Enter the market value of the player: -1000000 Market value cannot be negative!
Sample run (Remove a player from a team, display the squad before removing a player):
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 2
What is the unique ID of the Team?: 38
=================================================================================
= Team Details = =================================================================================
ID: 38
Team: Türkiye
Average Age: 24
Market Value: 206,500,000
Squad is composed of following players:
——————————————————————————–Name Age Nationality Number Position Market Value
———————————————————————————
Ugurcan Çakir 26 Türkiye 23 Goalkeeper 14,000,000
Altay Bayindir 24 Türkiye 1 Goalkeeper 13,000,000
Çaglar Söyüncü 26 Türkiye 4 Centre Back 22,000,000
Ozan Kabak 22 Türkiye 15 Centre Back 10,000,000
Tayyip Sanuç 22 Türkiye 6 Centre Back 3,800,000
Eren Elmali 22 Türkiye 13 Left Back 4,200,000
Zeki Çelik 25 Türkiye 2 Right Back 15,000,000
Salih Özcan 24 Türkiye 5 Defensive Midfield 17,000,000

Hakan Çalhanoglu 28 Türkiye 10 Central Midfield 35,000,000
Arda Güler 17 Türkiye 25 Attacking Midfield 10,000,000
Kerem Aktürkoglu 24 Türkiye 7 Left Wing 13,000,000
Cengiz Ünder 25 Türkiye 17 Right Wing 17,000,000
Enes Ünal 25 Türkiye 16 Centre Forward 25,000,000
Umut Bozok 26 Türkiye 19 Centre Forward 5,500,000
Cenk Tosun 31 Türkiye 9 Centre Forward 2,000,000
=================================================================================
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 4
What is the unique ID of the Team to remove the Player?: 38
Enter the jersey number of the player: 16
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 2
What is the unique ID of the Team?: 38
=================================================================================
= Team Details = =================================================================================
ID: 38
Team: Türkiye
Average Age: 24
Market Value: 181,500,000
Squad is composed of following players:
——————————————————————————–Name Age Nationality Number Position Market Value
———————————————————————————
Ugurcan Çakir 26 Türkiye 23 Goalkeeper 14,000,000
Altay Bayindir 24 Türkiye 1 Goalkeeper 13,000,000
Çaglar Söyüncü 26 Türkiye 4 Centre Back 22,000,000
Ozan Kabak 22 Türkiye 15 Centre Back 10,000,000
Tayyip Sanuç 22 Türkiye 6 Centre Back 3,800,000
Eren Elmali 22 Türkiye 13 Left Back 4,200,000
Zeki Çelik 25 Türkiye 2 Right Back 15,000,000
Salih Özcan 24 Türkiye 5 Defensive Midfield 17,000,000
Hakan Çalhanoglu 28 Türkiye 10 Central Midfield 35,000,000
Arda Güler 17 Türkiye 25 Attacking Midfield 10,000,000
Kerem Aktürkoglu 24 Türkiye 7 Left Wing 13,000,000
Cengiz Ünder 25 Türkiye 17 Right Wing 17,000,000
Umut Bozok 26 Türkiye 19 Centre Forward 5,500,000
Cenk Tosun 31 Türkiye 9 Centre Forward 2,000,000
=================================================================================
Sample run (Remove a player from a team; team does not exist!):
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 4
What is the unique ID of the Team to remove the Player?: 50 Team does not exist!
Sample run (Remove a player from a team; player does not exist!):
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 4
What is the unique ID of the Team to remove the Player?: 38 Enter the jersey number of the player: 88 Player does not exist!
Sample run (Add a game to the group, display standings to see the changes):
—————————————————
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 6
==================================
= Group A Standings =
==================================
1. Germany ( 6 ) 0 2. England ( 34 ) 0
3. Türkiye ( 38 ) 0
==================================
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————Your choice: 5
What is the unique ID of the First Team?: 38
What is the unique ID of the Second Team?: 6
Enter the score (such as 2 1): 3 3
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 6
==================================
= Group A Standings =
==================================
1. Germany ( 6 ) 1
2. Türkiye ( 38 ) 1
3. England ( 34 ) 0
==================================
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————Your choice: 5
What is the unique ID of the First Team?: 38
What is the unique ID of the Second Team?: 34
Enter the score (such as 2 1): 2 0
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 6
==================================
= Group A Standings =
==================================
1. Türkiye ( 38 ) 4 2. Germany ( 6 ) 1
3. England ( 34 ) 0
==================================
Sample run (Add a game to the group; first team does not exist!):
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————Your choice: 5
What is the unique ID of the First Team?: 12 First team does not exist!
Sample run (Add a game to the group, Second team does not exist!):
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————Your choice: 5
What is the unique ID of the First Team?: 38 What is the unique ID of the Second Team?: 12 Second team does not exist!
Sample run (Add a game to the group; scores cannot be negative!):
—————————————————
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 6
==================================
= Group A Standings =
==================================
1. Germany ( 6 ) 0 2. England ( 34 ) 0
3. Türkiye ( 38 ) 0
==================================
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————Your choice: 5
What is the unique ID of the First Team?: 38
What is the unique ID of the Second Team?: 34 Enter the score (such as 2 1): -2 1 Scores cannot be negative!
Sample run (Add multiple games between the same teams which will not have any effect):
—————————————————
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 6
==================================
= Group A Standings =
==================================
1. Germany ( 6 ) 0 2. England ( 34 ) 0
3. Türkiye ( 38 ) 0
==================================
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————Your choice: 5
What is the unique ID of the First Team?: 34
What is the unique ID of the Second Team?: 38
Enter the score (such as 2 1): 2 1
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 6
==================================
= Group A Standings =
==================================
1. England ( 34 ) 3
2. Germany ( 6 ) 0
3. Türkiye ( 38 ) 0
==================================

————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————Your choice: 5
What is the unique ID of the First Team?: 34
What is the unique ID of the Second Team?: 38
Enter the score (such as 2 1): 1 2
Already a game between the teams exists!
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 6
==================================
= Group A Standings =
==================================
1. England ( 34 ) 3 2. Germany ( 6 ) 0
3. Türkiye ( 38 ) 0
==================================
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team
5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————Your choice: 5
What is the unique ID of the First Team?: 38
What is the unique ID of the Second Team?: 34
Enter the score (such as 2 1): 2 1
Already a game between the teams exists!
————– Group: A ——————-
1 – Create a new Team
2 – Display a Team
3 – Add a Player to a Team
4 – Remove a Player with ID from a Team

5 – Add a Game to the Group
6 – Display Standings
7 – Exit
——————————————-
Your choice: 6
==================================
= Group A Standings =
==================================
1. England ( 34 ) 3 2. Germany ( 6 ) 0
3. Türkiye ( 38 ) 0
==================================

Reviews

There are no reviews yet.

Be the first to review “CS 101 – Algorithms & Programming I Solved”

Your email address will not be published. Required fields are marked *