Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Genomes And Databases On The Internet A Practical Guide To Functions And Applications

Authors: Paul Rangel

1st Edition

189848631X, 978-1898486312

More Books

Students also viewed these Databases questions

Question

Were they made on a timely basis?

Answered: 1 week ago

Question

Did the decisions need to be made, or had they already been made?

Answered: 1 week ago