Skip to content

Instantly share code, notes, and snippets.

@akuholla
Created August 10, 2021 15:24
Show Gist options
  • Save akuholla/22316010ff097bd10e748a0f8595de22 to your computer and use it in GitHub Desktop.
Save akuholla/22316010ff097bd10e748a0f8595de22 to your computer and use it in GitHub Desktop.
Country and capitals
/*
* Product Requirement: The following file returns a list of countries and a list of countries and capitals. Display the name of the first country on screen.
* Tapping on the country text will display a toast saying "The capital for <country name> is <country capital>"
*
* Things to note:
* + Start by creating a new project on Android Studio. Copy the entire contents of this file to your project.
* + You are not allowed to edit the contents of this file.
* + You are free to choose your path for implementing this solution.
* + You are allowed to look through any documentation and/or use a search engine for reference on syntax.
* + Please think out loud to keep the interviewers engaged in your solution.
*/
val COUNTRIES = """
[
{
"country_name": "Afghanistan",
"country_code": "AFG"
},
{
"country_name": "Denmark",
"country_code": "DEN"
},
{
"country_name": "Ireland",
"country_code": "IRL"
},
{
"country_name": "Russian Federation",
"country_code": "RUSS"
},
{
"country_name": "Taiwan",
"country_code": "TAI"
}
]
""".trimIndent()
val CAPITALS = listOf(
"""{ "country_name": "Afghanistan", "capital": "Kabul" }""",
"""{ "country_name": "Denmark", "capital": "Copenhagen" }""",
"""{ "country_name": "Ireland", "capital": "Dublin" }""",
"""{ "country_name": "Russian Federation", "capital": "Moscow" }""",
"""{ "country_name": "Taiwan Federation", "capital": "Taipei" }"""
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment