Class relationships: Correct Solution


Consider the follow class declarations:

public class Asmsas {
    public byte[] getUsPece() {
        ...
    }

    public byte[] getIspi() {
        ...
    }
}

public class Cismpen {
    public Lalkpas getPnu() {
        ...
    }

    public List<String> getThac() {
        ...
    }
}

public class Dibass {
    public byte[] getAnge() {
        ...
    }
}

public class Founthal extends Frariong {
    public List<Nabir> getSlaifs() {
        ...
    }
}

public class Frariong {
    public String getCerex() {
        ...
    }
}

public class Hisci {
    public List<String> getHords() {
        ...
    }

    public List<Inint> getIcNics() {
        ...
    }
}

public class HusCossgec {
    public List<String> getSeMera() {
        ...
    }
}

public class Iccess {
    public Melso getSaUnt() {
        ...
    }

    public Masmwang getEkSeouw() {
        ...
    }
}

public class Ikar extends Penxo {
    public Prascit getMei() {
        ...
    }

    public IoeOshplil getNeNin() {
        ...
    }
}

public class Inint {
    public String getNaist() {
        ...
    }
}

public class Intross {
    public String getEsCasen() {
        ...
    }
}

public class IoeOshplil {
    public List<Dibass> getPsols() {
        ...
    }

    public int getTohu() {
        ...
    }
}

public class Lalkpas extends Plapos {
    public List<Hisci> getIsmas() {
        ...
    }
}

public class Masmwang {
    public int getBilar() {
        ...
    }
}

public class Meen extends Padic {
    public List<Rouuc> getThus() {
        ...
    }
}

public class Melso {
    public Peted getThre() {
        ...
    }

    public List<Asmsas> getBisos() {
        ...
    }
}

public class Nabir {
    public Meen getQer() {
        ...
    }

    public int getUlNen() {
        ...
    }
}

public class Padic extends Iccess {
    public File getLoull() {
        ...
    }
}

public class Penxo {
    public String getFui() {
        ...
    }
}

public class Peted {
    public String getPikin() {
        ...
    }
}

public class Plapos extends Intross {
    public List<Founthal> getEnScors() {
        ...
    }
}

public class Prascit {
    public List<Traer> getRuHas() {
        ...
    }

    public HusCossgec getLeEl() {
        ...
    }
}

public class Rouuc {
    public byte[] getIrAng() {
        ...
    }
}

public class Traer extends Cismpen {
    public String getAthi() {
        ...
    }
}
  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:

    Ikar o

    ...and the following method:

    public void process(byte[] item)

    ...write code to process the ispi of each biso of the first slaif of the first enScor of the first ruHa of o.

    Solution

    for (Traer ruHa : o.getMei().getRuHasList()) {
        for (Founthal enScor : ruHa.getCismpen().getPnu().getPlapos().getEnScorsList()) {
            for (Nabir slaif : enScor.getSlaifsList()) {
                process(slaif.getQer().getPadic().getIccess().getSaUnt().getBisos().get(0).getIspi());
            }
        }
    }

Related puzzles: