Question: Problem 2 . ( 5 0 pts ) ou are given a task to implement a hierarchical data structure representing cities, regions, countries, and continents.

Problem 2.(50 pts) ou are given a task to implement a hierarchical data structure representing cities, regions, countries, and continents. Your implementation should allow you to create instances of these entities, link them appropriately, and print specific hierarchical information.
The structures and relationships are as follows:
Each City belongs to a Region.
Each Region contains multiple Cities and belongs to a Country.
Each Country contains multiple Regions and belongs to one or more Continents.
Each Continent contains one or more Countries.
Here are the specific requirements:
Define structures for City, Region, Country, and Continent.
City should have the variables below:
char name [50] City name
int population Population of the city
Region should have the variables below:
char name [50] Region name
int population Total population of the cities in the region
int num_cities Number of cities that the region has
Country should have the variables below:
char name [50] Country name
int population Total population of the cities in the country
int num_regions Number of regions that the country has
int num_continents Number of continents that the country has
Continent should have the variables below:
char name [50] Continent name
int population Total population of the cities in the continent int num_countries Number of countries that the continent has
Create instances of City, Region, Country, and Continent and establish their relationships.
Continent should point to Country.
4
Country should point to Continent and Region.
Region should point to Country and City.
City should point to Region.
Populate the data:
Include two continents, named "Europe" and "Asia".
Asia contains one country, "Turkey".
Europe contains two countries, "Turkey" and "France".
France has multiple regions, "Ile-de-France" and "Nouvelle-Aquitaine".
Turkey has multiple regions, "Marmara" and "Ege".
Paris and Yvelines (two cities in France) are in Ile-de-France, and the corresponding populations are 2161000 and 1437000, respectively.
Bordeaux (a city in France with 249712 population) is in Nouvelle-Aquitaine.
zmir (population: 4367000) and Manisa (population: 1430000) are in Ege region. Turkey.
stanbul (population: 15460000) is in Marmara region, Turkey.
Ensure proper memory allocation for dynamic data.
Name the variables so that the program will be able to print the following hierarchical information:
 Problem 2.(50 pts) ou are given a task to implement a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!