A country is defined as a Good Country if it has ALL the following properties:
- The number of cities should be between 200 to 300.
- The country should have nuclear power.
- The name of the country should contain the characters 'A' and 'I' but should not contain 'R'. (Assume case insensitive matching)
- The length of the country's name should be greater than or equal to 5.
- The name of the continent to which the country belongs should be "Asia" or "Africa"
- The country should have atleast 3 neighbouring countries none of which should end with the word "tan".
- If the country does not have any neighbouring countries, then the name of the country must match the name of the continent it is in.
Write a method:
boolean isGoodCountry(String countryName, int numCities, int numVillages, boolean hasNuclearPower, String continentName, String[] neighborCountries)
countryName | | Name of the country. |
numCities | | number of cities in the country. |
numVillages | | number of villages in the country. |
hasNuclearPower | | whether or not the country has nuclear power. |
continentName | | Name of the continent the country is situated in. |
neighborCountries | | an array containing the names of the neighboring countries. |