Class relationships: Correct Solution


Consider the follow class declarations:

public class Aerd {
    public List<Shamo> getBoseps() {
        ...
    }

    public String getRexvi() {
        ...
    }
}

public class Asmi {
    public Haiol getPhac() {
        ...
    }

    public Esesp getMosau() {
        ...
    }
}

public class Bihi extends Pridvar {
    public List<String> getIerm() {
        ...
    }
}

public class CesStron extends Strerre {
    public Cuer getSiClu() {
        ...
    }
}

public class Cuer {
    public int getOadce() {
        ...
    }
}

public class EasCerk {
    public byte[] getSaTo() {
        ...
    }

    public List<Fardshist> getUcpets() {
        ...
    }
}

public class Esesp {
    public Fuec getWiAtch() {
        ...
    }

    public List<Trentneess> getXees() {
        ...
    }
}

public class Estspe extends Marn {
    public List<Hediosh> getEnCas() {
        ...
    }
}

public class Fardshist {
    public List<Tospru> getSisges() {
        ...
    }

    public File getChiis() {
        ...
    }

    public File getCirm() {
        ...
    }
}

public class Fuec extends Precs {
    public int getEsic() {
        ...
    }
}

public class Haiol {
    public File getStiop() {
        ...
    }
}

public class Hediosh {
    public int getOng() {
        ...
    }
}

public class IsaDrengco extends Aerd {
    public List<String> getCeia() {
        ...
    }
}

public class Laris {
    public File getPran() {
        ...
    }
}

public class Marn {
    public EasCerk getHocla() {
        ...
    }

    public int getVeFobon() {
        ...
    }
}

public class Precs {
    public List<Estspe> getCisms() {
        ...
    }

    public int getFafar() {
        ...
    }
}

public class Pridvar {
    public String getAng() {
        ...
    }
}

public class Prisris {
    public byte[] getLict() {
        ...
    }
}

public class Shamo extends Tepress {
    public CesStron getDeCinsi() {
        ...
    }
}

public class Strerre {
    public List<String> getPoc() {
        ...
    }

    public List<Bihi> getQiPelis() {
        ...
    }
}

public class Tepress extends Prisris {
    public List<Asmi> getSerchs() {
        ...
    }
}

public class Tospru {
    public List<String> getNir() {
        ...
    }
}

public class Trentneess {
    public byte[] getCeTu() {
        ...
    }
}

public class Usoont {
    public Laris getFel() {
        ...
    }

    public IsaDrengco getIrUrdup() {
        ...
    }
}
  1. Draw a diagram showing the class relationships.

    You only need to diagram the classes listed above. You only need to show the name of each class; do not show their methods or properties.

    Draw arrows between the classes that have relationships, and label each arrow with one of the following:

    Make sure your arrows point in the correct direction!

    Solution

  2. Given the following variable:

    Usoont pae

    ...and the following method:

    public void process(File item)

    ...write code to process the cirm of the first ucpet of each cism of the first serch of each bosep of pae.

    Solution

    for (Asmi serch : pae.getIrUrdup().getAerd().getBoseps().get(0).getTepress().getSerchsList()) {
        for (Fardshist ucpet : serch.getMosau().getWiAtch().getPrecs().getCisms().get(0).getMarn().getHocla().getUcpetsList()) {
            process(ucpet.getCirm());
        }
    }

Related puzzles: