This is the second task I have gotten hung up on the same thing. My code keeps failing to run because of the private IncomeData incomeData; line. This is a direct requirement of the task, but whenever I try to run the code, the system comes back saying it is unable to do so because it cannot find IncomeData. I have looked at several other examples and it is written the same as those. I don't understand. Please help!
package com.codegym.task.task19.task1903;
/*
Adapting multiple interfaces
*/
import java.util.HashMap;
import java.util.Map;
public class Solution {
public static Map<String, String> countries = new HashMap<>();
static {
countries.put("US","Ukraine");
countries.put("US", "United States");
countries.put("FR", "France");
}
public static void main(String[] args) {
}
public static class IncomeDataAdapter implements Customer, Contact {
private IncomeData data;
IncomeDataAdapter (IncomeData incomeData){
this.incomeData=incomeData;
}
public String getCompanyName(){
return incomeData.getCompany();
}
public String getCountryName(){
String countryCode = incomeData.getCountryCode();
String country = Solution.countries.get(countryCode);
return country;
}
public String getName(){
String firstName = incomeData.getContactFirstName();
String lastName = incomeData.getContactLastName();
return lastName +", "+firstName;
}
public String getPhoneNumber(){
String phoneNumber = incomeData.getPhoneNumber;
String pn = incomeData.getCountryCode() + phoneNumber;
return pn;
}
}
public static interface IncomeData {
String getCountryCode(); // For example: US
String getCompany(); // For example: CodeGym Ltd.
String getContactFirstName(); // For example: John
String getContactLastName(); // For example: Smith
int getCountryPhoneCode(); // For example: 1
int getPhoneNumber(); // For example: 991234567
}
public static interface Customer {
String getCompanyName(); // For example: CodeGym Ltd.
String getCountryName(); // For example: United States
}
public static interface Contact {
String getName(); // For example: Smith, John
String getPhoneNumber(); // For example: +1(099)123-45-67
}
}