Прошу помощи, не понимаю где я не прав.
package com.javarush.task.task19.task1903;
/*
Адаптация нескольких интерфейсов
*/
import java.util.HashMap;
import java.util.Map;
public class Solution {
public static Map<String, String> countries = new HashMap<String, String>();
static {
countries.put("UA", "Ukraine");
countries.put("RU", "Russia");
countries.put("CA", "Canada");
}
public static void main(String[] args) {
}
public static class IncomeDataAdapter implements Contact, Customer{
private IncomeData data;
IncomeDataAdapter(IncomeData data) {
this.data = data;
}
@Override
public String getName() {
return this.data.getContactLastName() + ", " + this.data.getContactFirstName();
}
@Override
public String getPhoneNumber() {
String number = String.format("%010d", this.data.getPhoneNumber());
String code = number.substring(0, 2);
String first = number.substring(3,5);
String second = number.substring(6,7);
String third = number.substring(8,9);
return String.format("%+d(%s)%s-%s-%s",this.data.getCountryPhoneCode(), code, first, second, third);
}
@Override
public String getCompanyName() {
return this.data.getCompany();
}
@Override
public String getCountryName() {
return countries.get(this.data.getCountryCode());
}
}
public static interface IncomeData {
String getCountryCode(); //For example: UA
String getCompany(); //For example: JavaRush Ltd.
String getContactFirstName(); //For example: Ivan
String getContactLastName(); //For example: Ivanov
int getCountryPhoneCode(); //For example: 38
int getPhoneNumber(); //For example: 501234567
}
public static interface Customer {
String getCompanyName(); //For example: JavaRush Ltd.
String getCountryName(); //For example: Ukraine
}
public static interface Contact {
String getName(); //For example: Ivanov, Ivan
String getPhoneNumber(); //For example: +38(050)123-45-67
}
}