public List<Player> getPartyMembers(int state, int maxrange, GameObject rangefrom) { List<Player> result = new ArrayList<Player>(); Party party = getPlayer().getParty(); if (party == null) { if (checkPartyMember(getPlayer(), state, maxrange, rangefrom)) { result.add(getPlayer()); } return result; } for (Player _member : party.getPartyMembers()) { if (checkPartyMember(_member, state, maxrange, rangefrom)) { result.add(getPlayer()); } } return result; }
public static void main(String args[]) throws Exception { int testCases = Integer.parseInt(in.readLine()); for (int i = 0; i < testCases; i++) { StringTokenizer tokenizer = new StringTokenizer(in.readLine()); int n = Integer.parseInt(tokenizer.nextToken()); Party party = new Party(); for (int j = 0; j < n; j++) { Person person = new Person(j); tokenizer = new StringTokenizer(in.readLine()); while (tokenizer.hasMoreTokens()) person.add(Integer.parseInt(tokenizer.nextToken())); party.invite(person); } output(party); out.println(); } out.flush(); }
public static void main(String[] args) { int guests; int choice; Party aParty = new Party(); DinnerParty2 aDinnerParty = new DinnerParty2(); Scanner keyboard = new Scanner(System.in); System.out.print("Enter number of guests for the party >> "); guests = keyboard.nextInt(); aParty.setGuests(guests); System.out.println("The party has " + aParty.getGuests() + " guests."); aParty.displayInvitation(); System.out.print("Enter number of guests for the dinner party >> "); guests = keyboard.nextInt(); aDinnerParty.setGuests(guests); System.out.print("Enter the menu option -- 1 for chicken or 2 for beef >> "); choice = keyboard.nextInt(); aDinnerParty.setDinnerChoice(choice); System.out.println("The dinner party has " + aDinnerParty.getGuests() + " guests."); System.out.println("Menu option " + aDinnerParty.getDinnerChoice() + " will be served."); aDinnerParty.displayInvitation(); }
public static void output(Party party) throws Exception { out.print(party.getWaysToParty()); }