Class relationships: Correct Solution


Consider the follow class declarations:

public class Botho {
    public List<Welloc> getFruas() {
        ...
    }

    public KloBastchrit getRics() {
        ...
    }

    public List<Pheontpaur> getHicnis() {
        ...
    }
}

public class BreRecmiod {
    public byte[] getSaBie() {
        ...
    }
}

public class Despo extends Onqar {
    public IcsGonber getPoAprip() {
        ...
    }
}

public class Eaced {
    public String getSeAe() {
        ...
    }
}

public class GruPreh {
    public List<String> getIie() {
        ...
    }
}

public class IcsGonber {
    public int getSplid() {
        ...
    }
}

public class Ishic {
    public int getUscic() {
        ...
    }
}

public class KloBastchrit {
    public List<Despo> getBles() {
        ...
    }

    public File getDeff() {
        ...
    }
}

public class Nimp {
    public byte[] getQaPio() {
        ...
    }

    public Tuthas getLuGrac() {
        ...
    }
}

public class Onqar extends Eaced {
    public TroPricut getDus() {
        ...
    }
}

public class Pheontpaur {
    public List<Trishe> getHodops() {
        ...
    }

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

public class Piloess extends Trossheas {
    public GruPreh getHepon() {
        ...
    }
}

public class Priorwusm {
    public BreRecmiod getPra() {
        ...
    }

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

    public String getBliir() {
        ...
    }
}

public class Trishe {
    public byte[] getMirti() {
        ...
    }
}

public class TroPricut {
    public List<Nimp> getBuTolis() {
        ...
    }

    public String getElPiae() {
        ...
    }
}

public class Trossheas {
    public List<Botho> getWodsos() {
        ...
    }

    public String getSakol() {
        ...
    }
}

public class Tuthas extends Priorwusm {
    public Ishic getTico() {
        ...
    }
}

public class Welloc {
    public List<String> getChel() {
        ...
    }
}
  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:

    Piloess ji

    ...and the following method:

    public void process(String item)

    ...write code to process the bliir of the first buToli of the first ble of each wodso of ji.

    Solution

    for (Despo ble : ji.getTrossheas().getWodsos().get(0).getRics().getBlesList()) {
        for (Nimp buToli : ble.getOnqar().getDus().getBuTolisList()) {
            process(buToli.getLuGrac().getPriorwusm().getBliir());
        }
    }

Related puzzles: