Gift exchange name chooser











up vote
0
down vote

favorite












Before I post any code, I should probably explain the weird way we choose who buys stuff for who.




  • My family is made up of three branches.

  • No one buys for anyone else in the same branch.

  • Names are first given to the leader of each branch, and then one is given to each adult (except in branch three). The branch leader keeps the remaining names.

  • There is a 10/8/4 split between families, but the names are drawn in a 9/9/4 split. (Meaning branch two takes one extra name, and branch one takes one less.)

  • The leaders of each branch are not in the drawing.


As you can imagine, these rules made everything extremely difficult for me. In fact, I've used four different methods so far, and only the last (and messiest) one works completely, so that's the one I'll be showing you.



        package com.kestrel.test;

import java.util.ArrayList;
import java.util.Random;

public class Main4
{
public static int listLength;
public static int namesUnpicked;
public static int branchSize = {9, 9, 4};
public static boolean doSubSplit= {true, true, false};
public static Random rand = new Random();
public static FamilyMember member;

public static void main(String args)
{
FamilyMember.setup();

listLength = FamilyMember.familyMembers.size();
namesUnpicked = listLength;

ArrayList<ArrayList<String>> pools = new ArrayList<ArrayList<String>>(3);
ArrayList<String> pool1 = new ArrayList<String>();
ArrayList<String> pool2 = new ArrayList<String>();
ArrayList<String> pool3 = new ArrayList<String>();
pools.add(pool1);
pools.add(pool2);
pools.add(pool3);

for(int i = 0; i < listLength; i++)
{
member = FamilyMember.familyMembers.get(i);
for(int ii = 0; ii < branchSize.length; ii++)
{
if(member.branch != ii + 1)
{
pools.get(ii).add(member.name);
}
}
}

int timeout = 0;
while(namesUnpicked > 0 && timeout < 100)
{
for(int i = 0; i < 3; i++)
{
if(branchSize[i] > 0)
{
int timeout2 = 0;
while(timeout2 < 15)
{
member = FamilyMember.familyMembers.get(rand.nextInt(listLength));

if(pools.get(i).contains(member.name) && member.drawnBy == 0)
{
member.drawnBy = i + 1;
namesUnpicked--;
branchSize[i]--;
timeout = 0;
break;
}
timeout2++;
timeout++;
}
}
}
}

if(branchSize[0] + branchSize[1] + branchSize[2] != 0)
{
System.out.println("failed");
System.exit(0);
}

ArrayList<FamilyMember> children = new ArrayList<FamilyMember>();
ArrayList<FamilyMember> adults = new ArrayList<FamilyMember>();

for(int i = 0; i < 3; i++)
{
for(int ii = 0; ii < listLength; ii++)
{
member = FamilyMember.familyMembers.get(ii);
if(member.branch == i + 1 && member.status.equals("adult"))
{
adults.add(member);
}
else if(member.drawnBy == i + 1 && member.status.equals("child"))
{
children.add(member);
}
}

for(int ii = 0; ii < adults.size(); ii++)
{
while(true)
{
FamilyMember child = children.get(rand.nextInt(children.size()));

if(child.subDrawnBy == 0)
{
FamilyMember.familyMembers.get(child.index).subDrawnBy = adults.get(ii).index;
break;
}
}
}
adults.clear();
children.clear();
}

for(int i = 0; i < listLength; i++)
{
member = FamilyMember.familyMembers.get(i);
if(member.subDrawnBy != 0)
{
System.out.println(member.name + " drawn by " + FamilyMember.familyMembers.get(member.subDrawnBy).name);
}
else
{
switch(member.drawnBy)
{
case 1:
System.out.println(member.name + " drawn by Judy");
break;
case 2:
System.out.println(member.name + " drawn by Barbra");
break;
case 3:
System.out.println(member.name + " drawn by Jean");
break;
}
}
}
}
}


So, as you've probably noticed, there's a pretty good chance it will just fail. (Mostly due to the family sizes.) I could most likely fix that, but it works about 50% of the time. So it's easier to just re-run it.



The code runs in the same order as that list I made above the code, so I don't think I need to explain every single bit of code. But I will mention that the first half uses nested ArrayLists to create a drawing pool for each branch, containing everyone in the other two branches.



The second half however, I wrote on my way home yesterday, and was not very well thought out. I pass FamilyMember objects into two different arrays, and used what I suspect is a terrible way to keep track of where they were located in the original arraylist (I saved their position to an "index" variable upon creation in FamilyMember.java, see below).



package com.kestrel.test;

import java.util.ArrayList;

public class FamilyMember
{
public final String name;
public final int branch;
public final String status;
public int subDrawnBy = 0;
public int drawnBy = 0;
public int index = 0;

public static ArrayList<FamilyMember> familyMembers = new ArrayList<>();

public FamilyMember(String name, int branch, String status)
{
this.name = name;
this.branch = branch;
this.status = status;
this.index = familyMembers.size();
familyMembers.add(this);
}

public static void setup()
{
new FamilyMember("Jeff", 3, "child");
new FamilyMember("Lauren", 3, "child");
new FamilyMember("Julie", 3, "child");
new FamilyMember("David and Deidre", 3, "child");

new FamilyMember("Kim and Lee", 2, "adult");
new FamilyMember("Sam", 2, "child");
new FamilyMember("Jake", 2, "child");
new FamilyMember("Nathan", 2, "child");
new FamilyMember("Mike and Ashley", 2, "adult");
new FamilyMember("Jon and Meredith", 2, "adult");
new FamilyMember("ellie", 2, "child");
new FamilyMember("JD", 2, "child");

new FamilyMember("Jennifer and Wayne", 1, "adult");
new FamilyMember("Jonathon", 1, "child");
new FamilyMember("Bryant", 1, "child");
new FamilyMember("Lindsay", 1, "child");
new FamilyMember("Lisa and Brian", 1, "adult");
new FamilyMember("Pete", 1, "child");
new FamilyMember("Lucas", 1, "child");
new FamilyMember("Cathy and Lee", 1, "adult");
new FamilyMember("Elliott", 1, "child");
new FamilyMember("Russell", 1, "child");
}
}


And... that's about it. The FamilyMember class isn't that complicated, it's just an ArrayList, a constructor, and a method that creates all my family members. The only other thing I can think to mention would be that the reason I started some values at 1 instead of 0 was for readability when I was debugging. Sorry for any spelling errors, I'm not a great typist and stuff runs together when I'm reading plain black-on-white text.










share|improve this question
























  • Hi, that's an interesting one. This custom sounds great. Since I do not know such customs and just would like to get you right, could you provide an example, how it would work for you? Could be with less members, too. As long as you have the same criteria.
    – swinkler
    Dec 7 at 14:02

















up vote
0
down vote

favorite












Before I post any code, I should probably explain the weird way we choose who buys stuff for who.




  • My family is made up of three branches.

  • No one buys for anyone else in the same branch.

  • Names are first given to the leader of each branch, and then one is given to each adult (except in branch three). The branch leader keeps the remaining names.

  • There is a 10/8/4 split between families, but the names are drawn in a 9/9/4 split. (Meaning branch two takes one extra name, and branch one takes one less.)

  • The leaders of each branch are not in the drawing.


As you can imagine, these rules made everything extremely difficult for me. In fact, I've used four different methods so far, and only the last (and messiest) one works completely, so that's the one I'll be showing you.



        package com.kestrel.test;

import java.util.ArrayList;
import java.util.Random;

public class Main4
{
public static int listLength;
public static int namesUnpicked;
public static int branchSize = {9, 9, 4};
public static boolean doSubSplit= {true, true, false};
public static Random rand = new Random();
public static FamilyMember member;

public static void main(String args)
{
FamilyMember.setup();

listLength = FamilyMember.familyMembers.size();
namesUnpicked = listLength;

ArrayList<ArrayList<String>> pools = new ArrayList<ArrayList<String>>(3);
ArrayList<String> pool1 = new ArrayList<String>();
ArrayList<String> pool2 = new ArrayList<String>();
ArrayList<String> pool3 = new ArrayList<String>();
pools.add(pool1);
pools.add(pool2);
pools.add(pool3);

for(int i = 0; i < listLength; i++)
{
member = FamilyMember.familyMembers.get(i);
for(int ii = 0; ii < branchSize.length; ii++)
{
if(member.branch != ii + 1)
{
pools.get(ii).add(member.name);
}
}
}

int timeout = 0;
while(namesUnpicked > 0 && timeout < 100)
{
for(int i = 0; i < 3; i++)
{
if(branchSize[i] > 0)
{
int timeout2 = 0;
while(timeout2 < 15)
{
member = FamilyMember.familyMembers.get(rand.nextInt(listLength));

if(pools.get(i).contains(member.name) && member.drawnBy == 0)
{
member.drawnBy = i + 1;
namesUnpicked--;
branchSize[i]--;
timeout = 0;
break;
}
timeout2++;
timeout++;
}
}
}
}

if(branchSize[0] + branchSize[1] + branchSize[2] != 0)
{
System.out.println("failed");
System.exit(0);
}

ArrayList<FamilyMember> children = new ArrayList<FamilyMember>();
ArrayList<FamilyMember> adults = new ArrayList<FamilyMember>();

for(int i = 0; i < 3; i++)
{
for(int ii = 0; ii < listLength; ii++)
{
member = FamilyMember.familyMembers.get(ii);
if(member.branch == i + 1 && member.status.equals("adult"))
{
adults.add(member);
}
else if(member.drawnBy == i + 1 && member.status.equals("child"))
{
children.add(member);
}
}

for(int ii = 0; ii < adults.size(); ii++)
{
while(true)
{
FamilyMember child = children.get(rand.nextInt(children.size()));

if(child.subDrawnBy == 0)
{
FamilyMember.familyMembers.get(child.index).subDrawnBy = adults.get(ii).index;
break;
}
}
}
adults.clear();
children.clear();
}

for(int i = 0; i < listLength; i++)
{
member = FamilyMember.familyMembers.get(i);
if(member.subDrawnBy != 0)
{
System.out.println(member.name + " drawn by " + FamilyMember.familyMembers.get(member.subDrawnBy).name);
}
else
{
switch(member.drawnBy)
{
case 1:
System.out.println(member.name + " drawn by Judy");
break;
case 2:
System.out.println(member.name + " drawn by Barbra");
break;
case 3:
System.out.println(member.name + " drawn by Jean");
break;
}
}
}
}
}


So, as you've probably noticed, there's a pretty good chance it will just fail. (Mostly due to the family sizes.) I could most likely fix that, but it works about 50% of the time. So it's easier to just re-run it.



The code runs in the same order as that list I made above the code, so I don't think I need to explain every single bit of code. But I will mention that the first half uses nested ArrayLists to create a drawing pool for each branch, containing everyone in the other two branches.



The second half however, I wrote on my way home yesterday, and was not very well thought out. I pass FamilyMember objects into two different arrays, and used what I suspect is a terrible way to keep track of where they were located in the original arraylist (I saved their position to an "index" variable upon creation in FamilyMember.java, see below).



package com.kestrel.test;

import java.util.ArrayList;

public class FamilyMember
{
public final String name;
public final int branch;
public final String status;
public int subDrawnBy = 0;
public int drawnBy = 0;
public int index = 0;

public static ArrayList<FamilyMember> familyMembers = new ArrayList<>();

public FamilyMember(String name, int branch, String status)
{
this.name = name;
this.branch = branch;
this.status = status;
this.index = familyMembers.size();
familyMembers.add(this);
}

public static void setup()
{
new FamilyMember("Jeff", 3, "child");
new FamilyMember("Lauren", 3, "child");
new FamilyMember("Julie", 3, "child");
new FamilyMember("David and Deidre", 3, "child");

new FamilyMember("Kim and Lee", 2, "adult");
new FamilyMember("Sam", 2, "child");
new FamilyMember("Jake", 2, "child");
new FamilyMember("Nathan", 2, "child");
new FamilyMember("Mike and Ashley", 2, "adult");
new FamilyMember("Jon and Meredith", 2, "adult");
new FamilyMember("ellie", 2, "child");
new FamilyMember("JD", 2, "child");

new FamilyMember("Jennifer and Wayne", 1, "adult");
new FamilyMember("Jonathon", 1, "child");
new FamilyMember("Bryant", 1, "child");
new FamilyMember("Lindsay", 1, "child");
new FamilyMember("Lisa and Brian", 1, "adult");
new FamilyMember("Pete", 1, "child");
new FamilyMember("Lucas", 1, "child");
new FamilyMember("Cathy and Lee", 1, "adult");
new FamilyMember("Elliott", 1, "child");
new FamilyMember("Russell", 1, "child");
}
}


And... that's about it. The FamilyMember class isn't that complicated, it's just an ArrayList, a constructor, and a method that creates all my family members. The only other thing I can think to mention would be that the reason I started some values at 1 instead of 0 was for readability when I was debugging. Sorry for any spelling errors, I'm not a great typist and stuff runs together when I'm reading plain black-on-white text.










share|improve this question
























  • Hi, that's an interesting one. This custom sounds great. Since I do not know such customs and just would like to get you right, could you provide an example, how it would work for you? Could be with less members, too. As long as you have the same criteria.
    – swinkler
    Dec 7 at 14:02















up vote
0
down vote

favorite









up vote
0
down vote

favorite











Before I post any code, I should probably explain the weird way we choose who buys stuff for who.




  • My family is made up of three branches.

  • No one buys for anyone else in the same branch.

  • Names are first given to the leader of each branch, and then one is given to each adult (except in branch three). The branch leader keeps the remaining names.

  • There is a 10/8/4 split between families, but the names are drawn in a 9/9/4 split. (Meaning branch two takes one extra name, and branch one takes one less.)

  • The leaders of each branch are not in the drawing.


As you can imagine, these rules made everything extremely difficult for me. In fact, I've used four different methods so far, and only the last (and messiest) one works completely, so that's the one I'll be showing you.



        package com.kestrel.test;

import java.util.ArrayList;
import java.util.Random;

public class Main4
{
public static int listLength;
public static int namesUnpicked;
public static int branchSize = {9, 9, 4};
public static boolean doSubSplit= {true, true, false};
public static Random rand = new Random();
public static FamilyMember member;

public static void main(String args)
{
FamilyMember.setup();

listLength = FamilyMember.familyMembers.size();
namesUnpicked = listLength;

ArrayList<ArrayList<String>> pools = new ArrayList<ArrayList<String>>(3);
ArrayList<String> pool1 = new ArrayList<String>();
ArrayList<String> pool2 = new ArrayList<String>();
ArrayList<String> pool3 = new ArrayList<String>();
pools.add(pool1);
pools.add(pool2);
pools.add(pool3);

for(int i = 0; i < listLength; i++)
{
member = FamilyMember.familyMembers.get(i);
for(int ii = 0; ii < branchSize.length; ii++)
{
if(member.branch != ii + 1)
{
pools.get(ii).add(member.name);
}
}
}

int timeout = 0;
while(namesUnpicked > 0 && timeout < 100)
{
for(int i = 0; i < 3; i++)
{
if(branchSize[i] > 0)
{
int timeout2 = 0;
while(timeout2 < 15)
{
member = FamilyMember.familyMembers.get(rand.nextInt(listLength));

if(pools.get(i).contains(member.name) && member.drawnBy == 0)
{
member.drawnBy = i + 1;
namesUnpicked--;
branchSize[i]--;
timeout = 0;
break;
}
timeout2++;
timeout++;
}
}
}
}

if(branchSize[0] + branchSize[1] + branchSize[2] != 0)
{
System.out.println("failed");
System.exit(0);
}

ArrayList<FamilyMember> children = new ArrayList<FamilyMember>();
ArrayList<FamilyMember> adults = new ArrayList<FamilyMember>();

for(int i = 0; i < 3; i++)
{
for(int ii = 0; ii < listLength; ii++)
{
member = FamilyMember.familyMembers.get(ii);
if(member.branch == i + 1 && member.status.equals("adult"))
{
adults.add(member);
}
else if(member.drawnBy == i + 1 && member.status.equals("child"))
{
children.add(member);
}
}

for(int ii = 0; ii < adults.size(); ii++)
{
while(true)
{
FamilyMember child = children.get(rand.nextInt(children.size()));

if(child.subDrawnBy == 0)
{
FamilyMember.familyMembers.get(child.index).subDrawnBy = adults.get(ii).index;
break;
}
}
}
adults.clear();
children.clear();
}

for(int i = 0; i < listLength; i++)
{
member = FamilyMember.familyMembers.get(i);
if(member.subDrawnBy != 0)
{
System.out.println(member.name + " drawn by " + FamilyMember.familyMembers.get(member.subDrawnBy).name);
}
else
{
switch(member.drawnBy)
{
case 1:
System.out.println(member.name + " drawn by Judy");
break;
case 2:
System.out.println(member.name + " drawn by Barbra");
break;
case 3:
System.out.println(member.name + " drawn by Jean");
break;
}
}
}
}
}


So, as you've probably noticed, there's a pretty good chance it will just fail. (Mostly due to the family sizes.) I could most likely fix that, but it works about 50% of the time. So it's easier to just re-run it.



The code runs in the same order as that list I made above the code, so I don't think I need to explain every single bit of code. But I will mention that the first half uses nested ArrayLists to create a drawing pool for each branch, containing everyone in the other two branches.



The second half however, I wrote on my way home yesterday, and was not very well thought out. I pass FamilyMember objects into two different arrays, and used what I suspect is a terrible way to keep track of where they were located in the original arraylist (I saved their position to an "index" variable upon creation in FamilyMember.java, see below).



package com.kestrel.test;

import java.util.ArrayList;

public class FamilyMember
{
public final String name;
public final int branch;
public final String status;
public int subDrawnBy = 0;
public int drawnBy = 0;
public int index = 0;

public static ArrayList<FamilyMember> familyMembers = new ArrayList<>();

public FamilyMember(String name, int branch, String status)
{
this.name = name;
this.branch = branch;
this.status = status;
this.index = familyMembers.size();
familyMembers.add(this);
}

public static void setup()
{
new FamilyMember("Jeff", 3, "child");
new FamilyMember("Lauren", 3, "child");
new FamilyMember("Julie", 3, "child");
new FamilyMember("David and Deidre", 3, "child");

new FamilyMember("Kim and Lee", 2, "adult");
new FamilyMember("Sam", 2, "child");
new FamilyMember("Jake", 2, "child");
new FamilyMember("Nathan", 2, "child");
new FamilyMember("Mike and Ashley", 2, "adult");
new FamilyMember("Jon and Meredith", 2, "adult");
new FamilyMember("ellie", 2, "child");
new FamilyMember("JD", 2, "child");

new FamilyMember("Jennifer and Wayne", 1, "adult");
new FamilyMember("Jonathon", 1, "child");
new FamilyMember("Bryant", 1, "child");
new FamilyMember("Lindsay", 1, "child");
new FamilyMember("Lisa and Brian", 1, "adult");
new FamilyMember("Pete", 1, "child");
new FamilyMember("Lucas", 1, "child");
new FamilyMember("Cathy and Lee", 1, "adult");
new FamilyMember("Elliott", 1, "child");
new FamilyMember("Russell", 1, "child");
}
}


And... that's about it. The FamilyMember class isn't that complicated, it's just an ArrayList, a constructor, and a method that creates all my family members. The only other thing I can think to mention would be that the reason I started some values at 1 instead of 0 was for readability when I was debugging. Sorry for any spelling errors, I'm not a great typist and stuff runs together when I'm reading plain black-on-white text.










share|improve this question















Before I post any code, I should probably explain the weird way we choose who buys stuff for who.




  • My family is made up of three branches.

  • No one buys for anyone else in the same branch.

  • Names are first given to the leader of each branch, and then one is given to each adult (except in branch three). The branch leader keeps the remaining names.

  • There is a 10/8/4 split between families, but the names are drawn in a 9/9/4 split. (Meaning branch two takes one extra name, and branch one takes one less.)

  • The leaders of each branch are not in the drawing.


As you can imagine, these rules made everything extremely difficult for me. In fact, I've used four different methods so far, and only the last (and messiest) one works completely, so that's the one I'll be showing you.



        package com.kestrel.test;

import java.util.ArrayList;
import java.util.Random;

public class Main4
{
public static int listLength;
public static int namesUnpicked;
public static int branchSize = {9, 9, 4};
public static boolean doSubSplit= {true, true, false};
public static Random rand = new Random();
public static FamilyMember member;

public static void main(String args)
{
FamilyMember.setup();

listLength = FamilyMember.familyMembers.size();
namesUnpicked = listLength;

ArrayList<ArrayList<String>> pools = new ArrayList<ArrayList<String>>(3);
ArrayList<String> pool1 = new ArrayList<String>();
ArrayList<String> pool2 = new ArrayList<String>();
ArrayList<String> pool3 = new ArrayList<String>();
pools.add(pool1);
pools.add(pool2);
pools.add(pool3);

for(int i = 0; i < listLength; i++)
{
member = FamilyMember.familyMembers.get(i);
for(int ii = 0; ii < branchSize.length; ii++)
{
if(member.branch != ii + 1)
{
pools.get(ii).add(member.name);
}
}
}

int timeout = 0;
while(namesUnpicked > 0 && timeout < 100)
{
for(int i = 0; i < 3; i++)
{
if(branchSize[i] > 0)
{
int timeout2 = 0;
while(timeout2 < 15)
{
member = FamilyMember.familyMembers.get(rand.nextInt(listLength));

if(pools.get(i).contains(member.name) && member.drawnBy == 0)
{
member.drawnBy = i + 1;
namesUnpicked--;
branchSize[i]--;
timeout = 0;
break;
}
timeout2++;
timeout++;
}
}
}
}

if(branchSize[0] + branchSize[1] + branchSize[2] != 0)
{
System.out.println("failed");
System.exit(0);
}

ArrayList<FamilyMember> children = new ArrayList<FamilyMember>();
ArrayList<FamilyMember> adults = new ArrayList<FamilyMember>();

for(int i = 0; i < 3; i++)
{
for(int ii = 0; ii < listLength; ii++)
{
member = FamilyMember.familyMembers.get(ii);
if(member.branch == i + 1 && member.status.equals("adult"))
{
adults.add(member);
}
else if(member.drawnBy == i + 1 && member.status.equals("child"))
{
children.add(member);
}
}

for(int ii = 0; ii < adults.size(); ii++)
{
while(true)
{
FamilyMember child = children.get(rand.nextInt(children.size()));

if(child.subDrawnBy == 0)
{
FamilyMember.familyMembers.get(child.index).subDrawnBy = adults.get(ii).index;
break;
}
}
}
adults.clear();
children.clear();
}

for(int i = 0; i < listLength; i++)
{
member = FamilyMember.familyMembers.get(i);
if(member.subDrawnBy != 0)
{
System.out.println(member.name + " drawn by " + FamilyMember.familyMembers.get(member.subDrawnBy).name);
}
else
{
switch(member.drawnBy)
{
case 1:
System.out.println(member.name + " drawn by Judy");
break;
case 2:
System.out.println(member.name + " drawn by Barbra");
break;
case 3:
System.out.println(member.name + " drawn by Jean");
break;
}
}
}
}
}


So, as you've probably noticed, there's a pretty good chance it will just fail. (Mostly due to the family sizes.) I could most likely fix that, but it works about 50% of the time. So it's easier to just re-run it.



The code runs in the same order as that list I made above the code, so I don't think I need to explain every single bit of code. But I will mention that the first half uses nested ArrayLists to create a drawing pool for each branch, containing everyone in the other two branches.



The second half however, I wrote on my way home yesterday, and was not very well thought out. I pass FamilyMember objects into two different arrays, and used what I suspect is a terrible way to keep track of where they were located in the original arraylist (I saved their position to an "index" variable upon creation in FamilyMember.java, see below).



package com.kestrel.test;

import java.util.ArrayList;

public class FamilyMember
{
public final String name;
public final int branch;
public final String status;
public int subDrawnBy = 0;
public int drawnBy = 0;
public int index = 0;

public static ArrayList<FamilyMember> familyMembers = new ArrayList<>();

public FamilyMember(String name, int branch, String status)
{
this.name = name;
this.branch = branch;
this.status = status;
this.index = familyMembers.size();
familyMembers.add(this);
}

public static void setup()
{
new FamilyMember("Jeff", 3, "child");
new FamilyMember("Lauren", 3, "child");
new FamilyMember("Julie", 3, "child");
new FamilyMember("David and Deidre", 3, "child");

new FamilyMember("Kim and Lee", 2, "adult");
new FamilyMember("Sam", 2, "child");
new FamilyMember("Jake", 2, "child");
new FamilyMember("Nathan", 2, "child");
new FamilyMember("Mike and Ashley", 2, "adult");
new FamilyMember("Jon and Meredith", 2, "adult");
new FamilyMember("ellie", 2, "child");
new FamilyMember("JD", 2, "child");

new FamilyMember("Jennifer and Wayne", 1, "adult");
new FamilyMember("Jonathon", 1, "child");
new FamilyMember("Bryant", 1, "child");
new FamilyMember("Lindsay", 1, "child");
new FamilyMember("Lisa and Brian", 1, "adult");
new FamilyMember("Pete", 1, "child");
new FamilyMember("Lucas", 1, "child");
new FamilyMember("Cathy and Lee", 1, "adult");
new FamilyMember("Elliott", 1, "child");
new FamilyMember("Russell", 1, "child");
}
}


And... that's about it. The FamilyMember class isn't that complicated, it's just an ArrayList, a constructor, and a method that creates all my family members. The only other thing I can think to mention would be that the reason I started some values at 1 instead of 0 was for readability when I was debugging. Sorry for any spelling errors, I'm not a great typist and stuff runs together when I'm reading plain black-on-white text.







java






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 4 at 2:15









mdfst13

17.1k42155




17.1k42155










asked Dec 3 at 16:04









HamBone41801

406




406












  • Hi, that's an interesting one. This custom sounds great. Since I do not know such customs and just would like to get you right, could you provide an example, how it would work for you? Could be with less members, too. As long as you have the same criteria.
    – swinkler
    Dec 7 at 14:02




















  • Hi, that's an interesting one. This custom sounds great. Since I do not know such customs and just would like to get you right, could you provide an example, how it would work for you? Could be with less members, too. As long as you have the same criteria.
    – swinkler
    Dec 7 at 14:02


















Hi, that's an interesting one. This custom sounds great. Since I do not know such customs and just would like to get you right, could you provide an example, how it would work for you? Could be with less members, too. As long as you have the same criteria.
– swinkler
Dec 7 at 14:02






Hi, that's an interesting one. This custom sounds great. Since I do not know such customs and just would like to get you right, could you provide an example, how it would work for you? Could be with less members, too. As long as you have the same criteria.
– swinkler
Dec 7 at 14:02

















active

oldest

votes











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");

StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f208938%2fgift-exchange-name-chooser%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Code Review Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f208938%2fgift-exchange-name-chooser%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Terni

A new problem with tex4ht and tikz

Sun Ra