Class relationships: Correct Solution


Consider the follow class declarations:

public class Blirfoc extends Hircue {
    public List<Reue> getActros() {
        ...
    }
}

public class Firet {
    public int getWreu() {
        ...
    }
}

public class Fism extends Scia {
    public List<Jonrer> getHios() {
        ...
    }
}

public class Hircue extends Sniamset {
    public Fism getUer() {
        ...
    }
}

public class ImoCeas {
    public TirMorod getCac() {
        ...
    }

    public Pralke getBeot() {
        ...
    }
}

public class Jonrer extends PidKond {
    public String getSpu() {
        ...
    }
}

public class Miongro {
    public List<String> getCunam() {
        ...
    }

    public List<ImoCeas> getStocos() {
        ...
    }
}

public class PidKond {
    public Miongro getTeHier() {
        ...
    }

    public Winco getIoc() {
        ...
    }
}

public class Pithuint {
    public String getFiran() {
        ...
    }
}

public class Placoct {
    public String getNeAlel() {
        ...
    }

    public String getDiSted() {
        ...
    }
}

public class Pralke {
    public byte[] getGrai() {
        ...
    }

    public List<Placoct> getSwuns() {
        ...
    }
}

public class Reue {
    public File getTro() {
        ...
    }
}

public class Scia {
    public int getErIome() {
        ...
    }
}

public class Sniamset {
    public String getTia() {
        ...
    }

    public List<Firet> getBeos() {
        ...
    }
}

public class TirMorod {
    public int getPhin() {
        ...
    }

    public List<Pithuint> getSoTrars() {
        ...
    }
}

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

    Blirfoc ma

    ...and the following method:

    public void process(String item)

    ...write code to process the diSted of each swun of the first stoco of the first hio of ma.

    Solution

    for (Jonrer hio : ma.getHircue().getUer().getHiosList()) {
        for (ImoCeas stoco : hio.getPidKond().getTeHier().getStocosList()) {
            process(stoco.getBeot().getSwuns().get(0).getDiSted());
        }
    }

Related puzzles: