Class relationships: Correct Solution


Consider the follow class declarations:

public class Biounsjing {
    public List<Jecskism> getBiHas() {
        ...
    }

    public List<Mousm> getCesits() {
        ...
    }
}

public class Dold {
    public byte[] getBunli() {
        ...
    }
}

public class Edwus {
    public byte[] getAlOght() {
        ...
    }
}

public class Esis {
    public List<String> getPrais() {
        ...
    }

    public int getTernu() {
        ...
    }
}

public class Flingloos extends Esis {
    public byte[] getMul() {
        ...
    }
}

public class Hoics {
    public Dold getPaSted() {
        ...
    }

    public Popraur getSkad() {
        ...
    }

    public List<Isses> getSenmos() {
        ...
    }
}

public class Isses {
    public WheRiphlo getMorod() {
        ...
    }

    public Flingloos getIlReud() {
        ...
    }
}

public class Jecskism {
    public File getScave() {
        ...
    }
}

public class Mousm extends Hoics {
    public String getSeMiar() {
        ...
    }
}

public class Nossoun {
    public int getVaca() {
        ...
    }
}

public class Popraur {
    public byte[] getGecod() {
        ...
    }
}

public class Rhed extends Edwus {
    public Biounsjing getSesal() {
        ...
    }
}

public class Sedo extends Rhed {
    public List<Nossoun> getMitas() {
        ...
    }
}

public class WheRiphlo {
    public File getBeit() {
        ...
    }
}
  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:

    Sedo i

    ...and the following method:

    public void process(int item)

    ...write code to process the ternu of each senmo of the first cesit of i.

    Solution

    for (Mousm cesit : i.getRhed().getSesal().getCesitsList()) {
        process(cesit.getHoics().getSenmos().get(0).getIlReud().getEsis().getTernu());
    }

Related puzzles: