QuestionQuestion

Problem Description
It is required to build an information system to provide online information about airports across the world. The usual operations include adding new airport, updating country and airports data, and producing different reports based on the current data. As the number of airports is large (more than 46,000) a manual system will not be able to cope with the daily requests of different reports. It is decided to build this system based on the C++ knowledge you gained so far. The airports’ data are provided in a text file. Data for 247 countries are also provided in another text file (countries.csv).

Your strategy should be to create an Airport class with the above data items as data members (the first table), and a Country class with data members corresponding to the second table. Each country should be able to “know” all the airports that belong to it (use array or better use a vector to hold airports within a country class). In the main function, you should provide the capability to load all countries’ data from the file and store them in an array of objects. Next read the airports’ data and store them in the owner country. Further data processing is performed on this array.

Requirements
Develop the Airports Information System to meet the above requirements. Your system should perform the following operations:
- The Airport class should have the attributes given in the above tables. It should have a default constructor that sets all numeric data to zeros and all string data to null. It should have another parameterized constructor that sets the attributes to values passed by the parameters. It should have the usual setters and getters for each attribute. It should have a function to print all the data for the current airport, properly formatted. A function that calculated the distance between two airports must also be provided (you need to search the web for the formula). Its prototype is: double distanceTo(Airport theOther);

The Country class should have the following functions:
o Data members corresponding to each column in the second table given above.
o An array or a vector to hold all the airports of the country represented by the object.
o Setters and getters for all the above fields. For the array, a setter is not needed.
o Add default constructor and a parameterized constructor. Also add a function to add an airport to array member. Its prototype is: void addAirport(Airport& airport);

In the main program (function) provide the following capabilities:
o When the program starts, load all the countries data into an array of objects.
o Load all the airport data into the corresponding country (hint: use the addAirport() function).
o Provide the user with a menu of options so that he/she can easily work with the system to do the following: (choose friendly names for the menu options)
1. Display the latitude and longitude of a given airport. The user enters the icaoCode.
2. Display the number of airports in a given country. The user enters the isoCode for the country.
3. Display all the airports in in a given country. The user enters the isoCode for the country.
4. Display all the airports in a given continent.
5. Display all the large_airports in a given country. The user enters the isoCode for the country.
6. Display the distance between Doha International Airport and an airport whose icaoCode is entered by the user.
7. Display the distances between Doha International Airport and all airports of a given country.
8. Display all the airports in a given municipality. The user enters the name of the municipality.
9. Exit the application

Note:
1. The countries.csv and the airports.csv files will be given. Ask your instructor for a copy.
2. Properly format your code and output. Use meaningful names for the different identifiers in your code.
3. Validate user’s input.
4. Whenever possible, reuse functions.
5. The project's main function should start by loading the data from the given files. It should then provide a menu that will allow the user to choose one of the tasks at a time. The output should be paused until the user presses any key to go back to the menu. The program exits when the user selects option 9.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#include "Country.h"

Country::Country() {
    id = 0;
    code = NULL;
    name = NULL;
    continent = NULL;
    airports.clear();
}

Country::Country(int id,const char* code,const char* name,const char* continent){
   
    setId(id );
    setContinent(continent);
    setCode(code);
    setName(name);
    airports.clear();
}

Country::Country(const Country& o) {
    setId(o.id );
    setContinent(o.continent);
    setCode(o.code);
    setName(o.name);
    airports.clear();
    for (unsigned int i = 0; i < o.airports.size(); i++) {
       airports.push_back(o.airports.at(i));
    }   
}

Country::~Country() {   
    airports.clear();
}

void Country::setCode(const char* codes){

    this->code = new char[strlen(codes)];
    strcpy(this->code, codes);
}...

50% discount

Hours
Minutes
Seconds
$33.00 $16.50
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats