Class relationships: Correct Solution


Consider the follow class declarations:

public class Blusser {
    public String getPiPring() {
        ...
    }
}

public class Clishkid {
    public List<String> getOngec() {
        ...
    }
}

public class CocUosess extends Selch {
    public List<Moanhic> getBluls() {
        ...
    }
}

public class GloPiaw {
    public File getOros() {
        ...
    }
}

public class Jodsin {
    public List<CocUosess> getIrds() {
        ...
    }

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

public class Moanhic {
    public List<String> getOscad() {
        ...
    }
}

public class Nudelt {
    public File getToc() {
        ...
    }
}

public class Poctvia extends Blusser {
    public List<Clishkid> getCijuts() {
        ...
    }

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

public class Pungtes {
    public List<String> getTesec() {
        ...
    }
}

public class Romant {
    public int getEmBru() {
        ...
    }

    public Thunt getBriba() {
        ...
    }
}

public class Selch extends Romant {
    public int getHesgo() {
        ...
    }
}

public class Soin extends Nudelt {
    public List<String> getPlir() {
        ...
    }
}

public class SqaNadac {
    public String getMeuio() {
        ...
    }

    public Jodsin getPsas() {
        ...
    }
}

public class Thunt {
    public List<Uriss> getPeRungos() {
        ...
    }

    public GloPiaw getLiu() {
        ...
    }
}

public class Ught {
    public Soin getIrStuth() {
        ...
    }

    public List<Poctvia> getSeraes() {
        ...
    }
}

public class Uriss extends Ught {
    public Pungtes getOton() {
        ...
    }
}
  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:

    SqaNadac fa

    ...and the following method:

    public void process(List<String> item)

    ...write code to process the odDa of the first serae of each peRungo of each ird of fa.

    Solution

    for (Poctvia serae : fa.getPsas().getIrds().get(0).getSelch().getRomant().getBriba().getPeRungos().get(0).getUght().getSeraesList()) {
        process(serae.getOdDa());
    }

Related puzzles: