package net.sf.j2s.hello; public class SexSensible implements ISex { private static String capitalize(String word) { if (word != null && word.length() > 0) { char ch = word.charAt(0); if (ch > 'a' && ch < 'z') { ch -= 'a' - 'A'; } return ch + word.substring(1); } return word; } private int sex; public int getSex() { return sex; } public void setSex(int sex) { this.sex = sex; } public String getPronoun() { if (sex == FEMALE) { return "she"; } else { return "he"; } } public String getLeadingPronoun() { return capitalize(getPronoun()); } public String getAdjective() { if (sex == FEMALE) { return "her"; } else { return "his"; } } public String getLeadingAdjective() { return capitalize(getAdjective()); } }