Class relationships: Correct Solution


Consider the follow class declarations:

public class Ciorspee {
    public List<Prassec> getIaSkads() {
        ...
    }

    public Fesi getCoHi() {
        ...
    }
}

public class Ciri {
    public String getXarm() {
        ...
    }
}

public class Eang extends Spras {
    public byte[] getSnar() {
        ...
    }
}

public class Fesi extends Nenstal {
    public File getEnaed() {
        ...
    }

    public String getUdAd() {
        ...
    }
}

public class Moupoc {
    public List<String> getEwhi() {
        ...
    }

    public List<Vespraes> getCiOds() {
        ...
    }
}

public class Mulo extends Ciri {
    public int getEsiac() {
        ...
    }
}

public class Nenstal {
    public byte[] getMipsi() {
        ...
    }
}

public class Prassec {
    public File getEcdi() {
        ...
    }
}

public class Shengas {
    public List<Eang> getCobirs() {
        ...
    }

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

public class Spras {
    public Mulo getNaSpri() {
        ...
    }

    public Thrutol getCastu() {
        ...
    }

    public Moupoc getMetea() {
        ...
    }
}

public class Thrutol {
    public File getSihid() {
        ...
    }
}

public class Vespraes extends Ciorspee {
    public String getIsElte() {
        ...
    }
}
  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:

    Shengas mai

    ...and the following method:

    public void process(String item)

    ...write code to process the udAd of each ciOd of the first cobir of mai.

    Solution

    for (Eang cobir : mai.getCobirsList()) {
        process(cobir.getSpras().getMetea().getCiOds().get(0).getCiorspee().getCoHi().getUdAd());
    }

Related puzzles: