Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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++ image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management An Organizational Perspective

Authors: Richard T. Watson

1st Edition

0471305340, 978-0471305347

More Books

Students also viewed these Databases questions