public static class IncomeDataAdapter implements Customer, Contact{
        private IncomeData data;
        public IncomeDataAdapter(IncomeData data){
            this.data = data;
        }

        public String getCompanyName(){
            return data.getCompany();
        }

        public String getCountryName(){
            String countryName = null;
            for (Map.Entry<String, String> pair : countries.entrySet()){
                if (pair.getKey() == data.getCountryCode()){
                    countryName = pair.getValue();
                }
            }
            return countryName;
        }

        public String getName(){
            return data.getContactLastName() +
                ", " +
                data.getContactFirstName();
        }

        public String getPhoneNumber(){
            String number = data.getPhoneNumber() + "";
            for (int i = 0; i < 10-number.length(); i++){
                number = "0" + number;
            }
            return "+" + data.getCountryPhoneCode() +
                "(" +
                number.substring(0, 3) +
                ")" +
                number.substring(3, 6) +
                "-" +
                number.substring(6, 8) +
                "-" +
                number.substring(8, 10);
        }

    }
错误提示: 如果有必要,使用零填充电话号码,使其长度达到 10 位数(请参见示例)。 请注意人员的名字和姓氏的格式。