Question: C++ Question 3) (16 points) Each city has a name, number of residents (oksu ), and average yearly income(J) per resident. class City { public:

C++ C++ Question 3) (16 points) Each city has a name, number of

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)

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!