C++ program.Your travel agency offers trips to Asian and African countries. This month, you are specifically doing trips to the Philippines (in Asia) and Tunisia (in Africa) and created a program for users to get prices and a boarding ticket. For all Asian countries, you store the name and population information in your program. With African countries, in addition to the name and population, you are also interested in location (North, South, East, West). Create an abstract Country class that holds the country name and population (given by the constructor). There should be two functions: int get_ticket_price and void_print_boarding_pass (which will output a boarding pass as a file-see below) Using the Country class, create two classes called African_country and Asian_country. The Asian_country class should use the same constructor that the Country class uses and the African_country class constructor should allow for the user to enter the location (see sample run). Additionally, the two functions in the Country class should be implemented given the following information: For Asian countries, the price is calculated by multiplying the population by 5 unless your name is Pinoy Traveler. If that is your name, your ticket price is $100.
Make C++
-
Create an abstract Country class that holds the country name and population (given by the constructor). There should be two functions: int get_ticket_price and void_print_boarding_pass (which will output a boarding pass as a file-see below)
-
Using the Country class, create two classes called African_country and Asian_country. The Asian_country class should use the same constructor that the Country class uses and the African_country class constructor should allow for the user to enter the location (see sample run). Additionally, the two functions in the Country class should be implemented given the following information:
-
For Asian countries, the price is calculated by multiplying the population by 5 unless your name is Pinoy Traveler. If that is your name, your ticket price is $100.
-
For African countries, the price is calculated by multiplying the population by 3 and adding a $1000 travel tax. However, if your name is Moe Traveler and the African country happens to be located in the north, your ticket price is $100.
-
For boarding passes, a file will be named firstnameboarding.txt (the travelers first name and the word boarding combined). See sample files below for specific structures/messages/content for Asian and African countries
-
-
Using these classes, create a program that matches the sample run below (8 points for program matching sample run) (use the created classes . And do not put most of the work in the main):
(Hint: these could be the first lines of code in your main)
Asian_country a1("Philippines", 109); African_country a2("Tunisia",11);
Sample Run:
Creating country object...
Creating country object...
Does Tunisia lie in the north, south, east or west of Africa? None
Please enter a valid location:
north
~~Do you want to go to the Philippines or Tunisia? Philippines
Enter your full name:
Pinoy Traveler
Ticket price will be: $100. Do you still want to go? yes
Boarding pass printed!
Sample files created from sample run:
Pinoyboarding.txt
Passenger name: Pinoy Traveler Destination: Philippines
---Enjoy Asia!---
Randomboarding.txt
Passenger name: Random Traveler Destination: Philippines
---Enjoy Asia!---
Moeboarding.txt
Passenger name: Moe Traveler Destination: Tunisia
---Have fun in North Africa!---
Superboarding.txt
Passenger name: Super Traveler Destination: Tunisia
---Have fun in North Africa!---
Note for African countries, the location is included in the final message (above, North is included)
~~Do you want to go to the Philippines or Tunisia? Philippines
Enter your full name:
Random Traveler
Ticket price will be: $545. Do you still want to go? yes
Boarding pass printed!
~~Do you want to go to the Philippines or Tunisia? Tunisia
Enter your full name:
Moe Traveler
Ticket price will be: $100. Do you still want to go? yes
Boarding pass printed!
~~Do you want to go to the Philippines or Tunisia? Tunisia
Enter your full name:
Super Traveler
Ticket price will be: $1033. Do you still want to go? yes
Boarding pass printed!
~~Do you want to go to the Philippines or Tunisia? Tunisia
Enter your full name:
Bored Traveler
Ticket price will be: $1033. Do you still want to go? no
~~Do you want to go to the Philippines or Tunisia? exit
Trending now
This is a popular solution!
Step by step
Solved in 2 steps