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
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