Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need Help with this C++ Program I have to write 3 cpp files to mirror the header file and a main file. please code in

Need Help with this C++ Program I have to write 3 cpp files to mirror the header file and a main file. please code in C++ to get the Sample output at the bottom. I included the Header files in the instructions that were given and they cannot be altered. I am having trouble in getting the c and p command to react the way it does in the output as it just reverts to the Enter command prompt instead of asking to input details of the cargo or passenger plane. Any help would be appreciated below is the code block of the header files and the requirements of the program

// Specification file for the Airplane class #ifndef AIRPLANE_H #define AIRPLANE_H #include #include #include using namespace std; class Airplane { private: static int last_airplane_ID_issued; // Sequential airplane ID number value int airplane_ID; // Unique ID number for current Airplane string manufacturer; // Manufacturer name string model; // Manufacturer's model name int yearBuilt; // Year of Manufacture int flightHours; // Total hours of flight. public: // Constructors Airplane(); Airplane(string manufacturer, string model,int year, int hours); // Destructor virtual ~Airplane() { cout << "Destructor for Airplane " << airplane_ID << endl; } // Mutators void setManufacturer(string company); void setModel(string name); void setYearBuilt(int year); void setFlightHours(int hours); // Accessors string getManufacturer() const; string getModel() const; int getAirplane_ID() const; int getYearBuilt() const; int getFlightHours() const; static int get_last_airplane_ID_issued(); virtual string getDescription() const; }; #endif // Specification file for the PasengerPlane Class #ifndef PASSENGER_PLANE_H #define PASSENGER_PLANE_H #include #include #include #include "Airplane.h" using namespace std; class PassengerPlane : public Airplane { private: int maxNumberOfPassengers; // Maximum number of passengers public: // Default constructor PassengerPlane() : Airplane() { maxNumberOfPassengers = 0; } // Constructor PassengerPlane(string manufacturer, string model, int yearBuilt, int flightHours, int maxNumberOfPassengers) : Airplane( manufacturer, model, yearBuilt, flightHours) { this->maxNumberOfPassengers = maxNumberOfPassengers; } virtual ~PassengerPlane() { cout << "Destructor for PassengerPlane " << this->getAirplane_ID() << endl; } // Mutators void setMaxNumberOfPassengers(int passengers); static PassengerPlane* addNewPassengerPlane(); // Accessors int getMaxNumberOfPassengers() const; virtual string getDescription() const; }; #endif// Specification file for the CargoPlane Class #ifndef CARGO_PLANE_H #define CARGO_PLANE_H #include #include #include #include "Airplane.h" using namespace std; class CargoPlane : public Airplane { private: int maxCargoWeight; // Maximum weight of cargo public: // Constructors CargoPlane() : Airplane() { maxCargoWeight = 0; } CargoPlane(string manufacturer, string model, int yearBuilt, int flightHours, int maxCargoWeight) : Airplane( manufacturer, model, yearBuilt, flightHours) { this->maxCargoWeight = maxCargoWeight; } virtual ~CargoPlane() { cout << "Destructor for CargoPlane " << this->getAirplane_ID() << endl; } // Mutators void setMaxCargoWeight(int s); static CargoPlane* addNewCargoPlane(); // Accessors int getMaxCargoWeight() const; virtual string getDescription() 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

Deductive And Object Oriented Databases Second International Conference Dood 91 Munich Germany December 18 1991 Proceedings Lncs 566

Authors: Claude Delobel ,Michael Kifer ,Yoshifumi Masunaga

1st Edition

3540550151, 978-3540550150

More Books

Students also viewed these Databases questions

Question

a neglect of quality in relationship to international competitors;

Answered: 1 week ago