Assume you have a system with the followoing entities Region ID, Len, Width int Area ()//zero City Country ID, Len, Width Area () ID, Len, Width City *A//array of cities Area () 1. Implement the above system using inheritance in the best possible way. Keep every object size as small as possible. Implement all methods (setter/getter/constructors and destructors) Note that the region area is 0 while the city is len*width and the country is the sum of their cities. 2. Create array of countries called Arab of 22 countries. Write a function fill that fills the array Arab 3. Write a method that finds the city that has the max area in a country 4. Write a method that sorts the cities in a country from the largest to the smallest area 5. Write a function that retums array of countries of the same area of Arab 6. Write a function that compares between two countries. It retums true if countryl area greater than country2 area. 7. Write a function to move a city from one country to another.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 19RQ
icon
Related questions
Question

Write a program in the c ++ language that do the following.

All required in the picture...

Assume you have a system with the followoing entities
Region
ID, Len, Width
int Area ()//zero
City
Country
ID, Len, Width
Area ()
ID, Len, Width
City *A//array of cities
Area ()
1. Implement the above system using inheritance in the best possible way. Keep every object
size as small as possible. Implement all methods (setter/getter/constructors and destructors)
Note that the region area is 0 while the city is len*width and the country is the sum of their
cities.
2. Create array of countries called Arab of 22 countries. Write a function fill that fills the array
Arab
3. Write a method that finds the city that has the max area in a country
4. Write a method that sorts the cities in a country from the largest to the smallest area
5. Write a function that retums array of countries of the same area of Arab
6. Write a function that compares between two countries. It retums true if countryl area greater
than country2 area.
7. Write a function to move a city from one country to another.
Transcribed Image Text:Assume you have a system with the followoing entities Region ID, Len, Width int Area ()//zero City Country ID, Len, Width Area () ID, Len, Width City *A//array of cities Area () 1. Implement the above system using inheritance in the best possible way. Keep every object size as small as possible. Implement all methods (setter/getter/constructors and destructors) Note that the region area is 0 while the city is len*width and the country is the sum of their cities. 2. Create array of countries called Arab of 22 countries. Write a function fill that fills the array Arab 3. Write a method that finds the city that has the max area in a country 4. Write a method that sorts the cities in a country from the largest to the smallest area 5. Write a function that retums array of countries of the same area of Arab 6. Write a function that compares between two countries. It retums true if countryl area greater than country2 area. 7. Write a function to move a city from one country to another.
Expert Solution
steps

Step by step

Solved in 7 steps with 16 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,