Class relationships: Correct Solution


Consider the follow class declarations:

public class Bessdesk {
    public String getEsten() {
        ...
    }
}

public class Biocbon {
    public String getViar() {
        ...
    }
}

public class Chlirhed {
    public Prastmun getBuAd() {
        ...
    }

    public File getAuWunti() {
        ...
    }
}

public class Edir {
    public String getArSkoec() {
        ...
    }
}

public class Eert {
    public String getPhion() {
        ...
    }
}

public class Fafil {
    public String getLiIm() {
        ...
    }
}

public class Gasmgroin {
    public int getPason() {
        ...
    }
}

public class Iaend {
    public int getCutja() {
        ...
    }
}

public class Miemb extends Tenveac {
    public Iaend getSqa() {
        ...
    }

    public Trian getFiWep() {
        ...
    }
}

public class Nortstec {
    public Peit getSuda() {
        ...
    }

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

public class Opru {
    public File getPhist() {
        ...
    }
}

public class Peit {
    public List<String> getMicso() {
        ...
    }

    public Miemb getOiphi() {
        ...
    }
}

public class Plooss {
    public List<Sabas> getAcuis() {
        ...
    }

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

public class Prastmun extends Fafil {
    public List<Sclirhin> getAcats() {
        ...
    }

    public List<Biocbon> getGramos() {
        ...
    }
}

public class Qunua extends Nortstec {
    public List<Bessdesk> getHils() {
        ...
    }

    public Opru getTibi() {
        ...
    }
}

public class Rutwe {
    public Gasmgroin getPasm() {
        ...
    }

    public List<Screppron> getSoBes() {
        ...
    }
}

public class Sabas {
    public int getDed() {
        ...
    }
}

public class Sclirhin extends Eert {
    public List<Qunua> getIwDes() {
        ...
    }
}

public class Screppron extends Wica {
    public int getLoria() {
        ...
    }
}

public class Shophwe {
    public Rutwe getOceg() {
        ...
    }

    public String getEprin() {
        ...
    }
}

public class Tenveac extends Edir {
    public List<Shophwe> getFuses() {
        ...
    }
}

public class Trian extends Plooss {
    public byte[] getLiu() {
        ...
    }
}

public class Vioprai extends Chlirhed {
    public String getAess() {
        ...
    }
}

public class Wica {
    public int getFla() {
        ...
    }

    public int getOlsep() {
        ...
    }
}
  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:

    Vioprai stel

    ...and the following method:

    public void process(int item)

    ...write code to process the olsep of each soBe of each fus of the first iwDe of the first acat of stel.

    Solution

    for (Sclirhin acat : stel.getChlirhed().getBuAd().getAcatsList()) {
        for (Qunua iwDe : acat.getIwDesList()) {
            process(iwDe.getNortstec().getSuda().getOiphi().getTenveac().getFuses().get(0).getOceg().getSoBes().get(0).getWica().getOlsep());
        }
    }

Related puzzles: