Menu

Question 3 16 Points City Name Number Residents Oksu Average Yearly Income J Per Resident Q43805656

C++
Question 3) (16 points) Each city has a name, number of residents (oksu ), and average yearly income(Já) per resident. classQuestion 3) (16 points) Each city has a name, number of residents (oksu ), and average yearly income(Já) per resident. class City { public: City (string name, int numResident, float avg Income) City (): float GetCityIncome (); private: string name: float income; int numResidents; ); Write the implementation of the following functions: A. GetCityIncome function. This computes the total yearly income of the city according to the given income and number of residents. (2 points) B. Overload the + operator such that it allows combing two cities into one new city object. The combination should reflect the merging of two cities including the name, income and number of residents. Note that the average income of the combination should reflect correctly for the total of the two merged cities. The name should include both names. (3 points) C. Overload the > operation to compare between the two city objects and return true if the left city has more income. ( 2 points) Show transcribed image text Question 3) (16 points) Each city has a name, number of residents (oksu ), and average yearly income(Já) per resident. class City { public: City (string name, int numResident, float avg Income) City (): float GetCityIncome (); private: string name: float income; int numResidents; ); Write the implementation of the following functions: A. GetCityIncome function. This computes the total yearly income of the city according to the given income and number of residents. (2 points) B. Overload the + operator such that it allows combing two cities into one new city object. The combination should reflect the merging of two cities including the name, income and number of residents. Note that the average income of the combination should reflect correctly for the total of the two merged cities. The name should include both names. (3 points) C. Overload the > operation to compare between the two city objects and return true if the left city has more income. ( 2 points)

Expert Answer


Answer to Question 3) (16 points) Each city has a name, number of residents (oksu ), and average yearly income(Já) per resident. …

OR