Answered step by step
Verified Expert Solution
Question
1 Approved Answer
SOLVE IN C++ Problem: People living in Turkey are classified as locals and foreigners. For locals, we are interested in the TC ID, name, age,
SOLVE IN C++
Problem: People living in Turkey are classified as locals and foreigners. For locals, we are interested in the TC ID, name, age, and city of residency. For foreigners, we are interested in the TC ID, name, age number of years spent in Turkey, their country of origin, and city of residency in Turkey. a) Define a base class and a derived class to represent residents (local and foreign) of Turkey. The data described above should be in the private part of the classes. b) Add in each of the classes a constructor to set the values of its variables to corresponding parameters passed in the header. c) Add to each class a print function to print all possible characteristics of objects of that class-type. d) Add to each class a read function to input all possible characteristics of objects of that class-type. e) Add an overloaded function for pre-increment (++) to increase the age of a person by 1. For foreigners, the function should also increase the number of years spent in Turkey by 1. f) Add to each class a function to change the city of residency of a person. Note that all functions are to be added to the public part of the classes. Write a test program to simulate the following scenario: Create a list of residents with at least 5 locals and 5 foreigners. Simulate the movement of residents for 5 years: Each year, at least one foreigner or local is leaving the country and a new foreigner is coming to Turkey. o Each year, at least one local and one foreigner change their city. Each year, update the ages and years of residency for all residents. o Print the current information of all residents at the end of each yearStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started