Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement the class code.h that work with the provided testCode.cpp // // testCode.cpp // // test the Code predicate #include Facility.h #include Code.h #include #include

Implement the class code.h that work with the provided testCode.cpp

//

// testCode.cpp

//

// test the Code predicate

#include "Facility.h"

#include "Code.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->code() << " " << f->name() << endl;

cout << "test if DFW: " << boolalpha << Code("DFW ")(f) << endl;

cout << "test if SFO: " << boolalpha << Code("SFO ")(f) << 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

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

Students also viewed these Databases questions

Question

=+2 Why are so many countries bothered by their brain drains?

Answered: 1 week ago