Adapting multiple interfaces

  • 20
Adapt IncomeData to the Customer and Contact interfaces. The adapter class is IncomeDataAdapter. Initialize countries before running the program. Mapping between country codes and country names: UA Ukraine US United States FR France If necessary, pad phone numbers with zeros to get 10 digits long (s
You can't complete this task, because you're not signed in.
Comments (7)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Mateusz Level 29, Poland
16 September 2020, 10:01
If you have problems with phone number formatting, StringBuffer or StringBuilder come in handy :)
Nastya Level 19, Moscow, Russia
13 August 2020, 17:57
Maybe it can help Use String.format() "%010d" replaceAll("(\\d{3})(\\d{3})(\\d{2})(\\d{2})", "($1)$2-$3-$4")
Felix Level 19
22 April 2020, 22:48
"If necessary, pad phone numbers with zeros to get 10 digits long (see the examples)." Which examples?
Henrique Level 41, São Paulo, Brazil
29 June 2020, 14:49
I think it's referring to line 45. The given number is 9 digits long ("991234567", line 33), and it's padded with a "0" to make it 10 digits long on line 45 (after the country phone code).
Dave Andrea Level 41, Canada
8 April 2020, 19:38
I couldn't figure out why, but when using regex for the phone number, it only accepted it with a "." for each place value and not a "/d". In case anyone else gets stuck on that.
Naina Gupta Level 20, Kulu, India
11 February 2020, 17:46
Can't figure out what I am doing wrong when forming the phone number.
Roman Level 41
13 February 2020, 06:30
Please post your question with the attached solution in the section Help.