Class relationships: Correct Solution


Consider the follow class declarations:

public class Ashai {
    public String getSepha() {
        ...
    }
}

public class Atpre {
    public String getPiEetir() {
        ...
    }
}

public class Bior extends Ponpran {
    public List<Couhi> getOfasses() {
        ...
    }
}

public class Couhi extends Grud {
    public int getPlas() {
        ...
    }
}

public class Dras {
    public int getApont() {
        ...
    }

    public List<Esta> getIants() {
        ...
    }
}

public class ErmCoisa {
    public String getFeslu() {
        ...
    }
}

public class Esta {
    public Heosm getOsSo() {
        ...
    }

    public List<Atpre> getSisens() {
        ...
    }
}

public class Grud {
    public File getCeba() {
        ...
    }

    public List<Trupdel> getScibos() {
        ...
    }

    public File getPruc() {
        ...
    }
}

public class Heosm {
    public List<Riorsong> getDirwes() {
        ...
    }

    public List<OirOiriat> getRiFos() {
        ...
    }

    public List<ErmCoisa> getZaops() {
        ...
    }
}

public class Hodeec extends PuiStodgri {
    public List<String> getErash() {
        ...
    }
}

public class IssMiom {
    public int getTiol() {
        ...
    }
}

public class OirOiriat extends Pudpre {
    public IssMiom getSqast() {
        ...
    }
}

public class Pitsesm {
    public Bior getSoctu() {
        ...
    }

    public String getOcpi() {
        ...
    }
}

public class Ponpran {
    public Trec getTada() {
        ...
    }

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

public class Pudpre {
    public String getEec() {
        ...
    }

    public Rhif getEdVe() {
        ...
    }
}

public class PuiStodgri {
    public List<Thiulti> getNoAoses() {
        ...
    }

    public Dras getBrout() {
        ...
    }
}

public class Rhif extends Stoth {
    public Spingil getHeHencu() {
        ...
    }
}

public class Riorsong {
    public List<String> getNelor() {
        ...
    }
}

public class Spingil {
    public byte[] getPraft() {
        ...
    }
}

public class Stehi {
    public List<String> getIsFi() {
        ...
    }
}

public class Stoth {
    public List<Pitsesm> getSiEsmans() {
        ...
    }

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

public class Thiulti extends Ashai {
    public Stehi getOsha() {
        ...
    }
}

public class Trec {
    public int getCeelt() {
        ...
    }
}

public class Trupdel {
    public String getCae() {
        ...
    }
}
  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:

    Hodeec me

    ...and the following method:

    public void process(File item)

    ...write code to process the pruc of the first ofass of each siEsman of each riFo of the first iant of me.

    Solution

    for (Esta iant : me.getPuiStodgri().getBrout().getIantsList()) {
        for (Couhi ofass : iant.getOsSo().getRiFos().get(0).getPudpre().getEdVe().getStoth().getSiEsmans().get(0).getSoctu().getOfassesList()) {
            process(ofass.getGrud().getPruc());
        }
    }

Related puzzles: