Class relationships: Correct Solution


Consider the follow class declarations:

public class Arpin {
    public int getLel() {
        ...
    }
}

public class AthIntral {
    public Hiad getSkack() {
        ...
    }

    public File getHeru() {
        ...
    }
}

public class Balua {
    public List<Rards> getSposes() {
        ...
    }

    public List<Intef> getEbeds() {
        ...
    }
}

public class Bleadhi {
    public int getDoi() {
        ...
    }
}

public class Bussang {
    public String getUet() {
        ...
    }

    public List<Plipkeg> getLusms() {
        ...
    }
}

public class Cralshep {
    public int getOnvi() {
        ...
    }

    public List<Stian> getSpochs() {
        ...
    }
}

public class Cron {
    public List<String> getRal() {
        ...
    }
}

public class Henir extends Arpin {
    public List<String> getPsio() {
        ...
    }
}

public class Hiad extends Hiin {
    public File getUas() {
        ...
    }
}

public class Hiin extends Xetdaork {
    public Cralshep getReDuss() {
        ...
    }
}

public class Intef extends AthIntral {
    public List<Bleadhi> getThecks() {
        ...
    }
}

public class Knaec {
    public Preca getWiAng() {
        ...
    }

    public int getHoGii() {
        ...
    }
}

public class Mebo {
    public byte[] getImal() {
        ...
    }
}

public class Orchbed {
    public List<String> getMai() {
        ...
    }

    public List<SliGrau> getCucs() {
        ...
    }
}

public class Plipkeg {
    public Knaec getLemas() {
        ...
    }

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

    public int getAnPse() {
        ...
    }
}

public class Preca {
    public String getIoUss() {
        ...
    }
}

public class Rards {
    public String getIcri() {
        ...
    }
}

public class SliGrau extends Bussang {
    public List<String> getTruad() {
        ...
    }
}

public class Stian extends Mebo {
    public Cron getElCint() {
        ...
    }

    public Orchbed getCuNepoc() {
        ...
    }

    public List<Henir> getRioses() {
        ...
    }
}

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

    Balua e

    ...and the following method:

    public void process(int item)

    ...write code to process the anPse of each lusm of each cuc of the first spoch of each ebed of e.

    Solution

    for (Stian spoch : e.getEbeds().get(0).getAthIntral().getSkack().getHiin().getReDuss().getSpochsList()) {
        process(spoch.getCuNepoc().getCucs().get(0).getBussang().getLusms().get(0).getAnPse());
    }

Related puzzles: