Pages

Ancestors

class Person
{
    Person father = null;
    Person mother = null;
    String name = "";
}

class People
{
    static Person
      adam, eve, cain, abel, seth,
      enoch1, irad, mehujael, methushael, lamech1, zillah, tubalCain, naamah,
      enos, kenan, mahalalel, jared, enoch2, methusaleh, lamech2, noah,
      shem, ham, japheth;

    public static void initialize()
    {
        // Adam and Eve's family
        adam = new Person();
        eve = new Person();
        cain = new Person();
        abel = new Person();
        seth = new Person();

        // Of unknown ancestry
        zillah = new Person();

        // Cain's descendants
        enoch1 = new Person();
        irad = new Person();
        mehujael = new Person();
        methushael = new Person();
        lamech1 = new Person();
        tubalCain = new Person();
        naamah = new Person();

        // Seth's descendants
        enos = new Person();
        kenan = new Person();
        mahalalel = new Person();
        jared = new Person();
        enoch2 = new Person();
        methusaleh = new Person();
        lamech2 = new Person();
        noah = new Person();

        // Naamah and Noah's children
        shem = new Person();
        ham = new Person();
        japheth = new Person();
    }
}

public class Ancestors
{
    static int GENERATION_LIMIT = -12;
    
    static void print(Person p, String relationship, int generation)
    {
        if (generation < GENERATION_LIMIT)
          return;
        for (int i = 0; i > generation; i--)
            System.out.print("  ");
        System.out.println(relationship + p.name);
        if (p.father != null)
            Ancestors.print(p.father, "father: ", generation - 1);
        if (p.mother != null)
            Ancestors.print(p.mother, "mother: ", generation - 1);
    }

    public static void main(String[] args)
    {
    }
}