Class relationships: Correct Solution


Consider the follow class declarations:

public class Ascis extends Ierm {
    public File getOced() {
        ...
    }

    public String getDold() {
        ...
    }
}

public class Cheadsom extends Ascis {
    public List<Troc> getKades() {
        ...
    }
}

public class Cloi {
    public byte[] getEto() {
        ...
    }
}

public class Couss {
    public byte[] getLupa() {
        ...
    }
}

public class Dichrar {
    public List<String> getAgDrint() {
        ...
    }

    public List<Gomma> getIdpases() {
        ...
    }
}

public class EedNuake {
    public Seenpral getAlten() {
        ...
    }

    public int getNes() {
        ...
    }
}

public class Gomma extends Sphocbal {
    public String getAimi() {
        ...
    }
}

public class Heon {
    public byte[] getIang() {
        ...
    }
}

public class Ierm {
    public String getOltib() {
        ...
    }
}

public class Injos {
    public int getDuIr() {
        ...
    }

    public List<Heon> getEoTasms() {
        ...
    }
}

public class Macprar {
    public List<String> getUsna() {
        ...
    }

    public List<Wolha> getProus() {
        ...
    }
}

public class Plar {
    public List<EedNuake> getEstpus() {
        ...
    }

    public String getUnLaae() {
        ...
    }
}

public class Ponbe {
    public byte[] getOta() {
        ...
    }

    public List<Puermpsos> getKaEns() {
        ...
    }
}

public class Puermpsos {
    public int getAng() {
        ...
    }

    public Cheadsom getDrur() {
        ...
    }
}

public class Seenpral {
    public int getSqeae() {
        ...
    }
}

public class Sengil {
    public Dichrar getEssti() {
        ...
    }

    public Couss getIdDocom() {
        ...
    }

    public Slewuerd getSarm() {
        ...
    }
}

public class Seshri extends SomEdshour {
    public String getPiTrii() {
        ...
    }
}

public class Singia {
    public List<String> getSaDi() {
        ...
    }

    public List<Seshri> getPoDuisses() {
        ...
    }
}

public class Slewuerd {
    public String getCend() {
        ...
    }
}

public class SomEdshour extends Trec {
    public Ponbe getOcick() {
        ...
    }
}

public class Sphocbal {
    public Cloi getWhu() {
        ...
    }

    public Singia getNuDul() {
        ...
    }
}

public class Trec {
    public List<Injos> getCiSpres() {
        ...
    }

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

public class Troc {
    public int getMoum() {
        ...
    }
}

public class Wolha extends Sengil {
    public List<Plar> getAcRiars() {
        ...
    }
}
  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:

    Macprar fa

    ...and the following method:

    public void process(String item)

    ...write code to process the dold of the first kaEn of each poDuiss of each idpas of the first prou of fa.

    Solution

    for (Wolha prou : fa.getProusList()) {
        for (Puermpsos kaEn : prou.getSengil().getEssti().getIdpases().get(0).getSphocbal().getNuDul().getPoDuisses().get(0).getSomEdshour().getOcick().getKaEnsList()) {
            process(kaEn.getDrur().getAscis().getDold());
        }
    }

Related puzzles: