Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement the file siteNumber.h that works with the provided c++ program testSiteNumber.cpp // testSiteNumber.cpp // // test the SiteNumber predicate #include Facility.h #include Runway.h #include

Implement the file siteNumber.h that works with the provided c++ program testSiteNumber.cpp

// testSiteNumber.cpp

//

// test the SiteNumber predicate

#include "Facility.h"

#include "Runway.h"

#include "SiteNumber.h"

#include

#include

#include

#include

using namespace std;

int main(int argc, char **argv)

{

ifstream facilities_file("testFacility1.in");

string line;

getline(facilities_file,line);

Facility *f = new Facility(line);

cout << f->site_number() << " " << f->code() << " " << f->name() << endl;

cout << "test if 02187.*A : " << boolalpha

<< SiteNumber("02187.*A ")(f) << endl;

cout << "test if 04508.*A : " << boolalpha

<< SiteNumber("04508.*A ")(f) << endl;

ifstream runways_file("testRunway1.in");

getline(runways_file,line);

Runway *r = new Runway(line);

cout << r->site_number() << " " << r->name() << " " << r->length() << endl;

cout << "test if 02187.*A : " << boolalpha

<< SiteNumber("02187.*A ")(r) << endl;

cout << "test if 04508.*A : " << boolalpha

<< SiteNumber("04508.*A ")(r) << endl;

delete f;

}

//

// Facility.h

//

#ifndef FACILITY_H

#define FACILITY_H

#include

class Facility

{

public:

Facility(std::string s);

std::string site_number(void) const;

std::string type(void) const;

std::string code(void) const;

std::string name(void) const;

double latitude(void) const;

double longitude(void) const;

double distance(double lat, double lon) const;

private:

const std::string site_number_;

const std::string type_;

const std::string code_;

const std::string name_;

const double latitude_, longitude_;

double convert_latitude(std::string s) const;

double convert_longitude(std::string s) const;

};

#endif

//

// Runway.h

//

#ifndef RUNWAY_H

#define RUNWAY_H

#include

class Runway

{

public:

Runway(std::string s);

std::string site_number(void) const;

std::string name(void) const;

int length(void) const;

private:

int convert_length(std::string s) const;

const std::string site_number_;

const std::string name_;

const int length_;

};

#endif

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

More Books

Students also viewed these Databases questions

Question

5. Discuss the role of the Web in career management.

Answered: 1 week ago

Question

4. Design a career management system.

Answered: 1 week ago

Question

4. Evaluation is ongoing and used to improve the system.

Answered: 1 week ago