Question: Write a C++ program: Write a class to contain the following information about towns: the name (a sequence of characters); the population (an integer); and

Write a C++ program:

Write a class to contain the following information about towns: the name (a sequence of characters); the population (an integer); and a Boolean value (i.e. true or false) which indicates whether the town has an airport or not. Make the three data members private. Include a constructor that initialises the data members. And Now add three new member functions to the towns class that assign values to the three data members. Also add a member function to print out all the information about a town. The member functions should all be publicly accessible. Write a main() function which declares three town objects and assigns the following values to them:

Name: London Manchester Liverpool 

Population: 1 000 000 50 000 35 000

Airport: True True False

After assigning values to the three objects, the program should print the details of thoose three to the screen.

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!