Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ultimateFrisbee;
- import java.util.ArrayList;
- public class UltimateTeam {
- private ArrayList<UltimatePlayer> players = new ArrayList<UltimatePlayer>();
- private ArrayList<Coach> coaches = new ArrayList<Coach>();
- public UltimateTeam(ArrayList<UltimatePlayer> player, ArrayList <Coach> coach){
- this.players = player;
- this.coaches = coach ;
- }
- public String getCutters() {
- String cutters = "";
- for(UltimatePlayer p: players) {
- if(p.getPosition().equals("cutter")) {
- cutters += p;
- cutters += '\n' ;
- }
- }
- return cutters ;
- }
- public String getHandlers() {
- String handlers = "";
- for(UltimatePlayer p1: players) {
- if(p1.getPosition().equals("handler")) {
- handlers += p1;
- handlers += '\n';
- }
- }
- return handlers ;
- }
- public String toString(){
- String output = "COACHES\n";
- for(Coach c: coaches){
- output += c;
- output += "\n";
- }
- output += "\nPLAYERS\n";
- for(UltimatePlayer pl: players){
- output += pl;
- output += "\n";
- }
- return output;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement