AircraftTest.cpp: // MS Visual Studio 2015 uses "stdafx.h" - 2017 uses "pch.h" //#include "stdafx.h" //#include "pch.h" //OK if you need to change strcpy to strcpy_s OR use any of these #pragma settings for Visual Studio- Professor Keith // Visual Studio "fixes" for strcpy //#define _CRT_SECURE_NO_WARNINGS //#pragma warning(disable : 4996) #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1 #include #include #include #include "Aircraft.h" #include "CommercialAircraft.h" using namespace std; int main() {   Aircraft basicPlane;   basicPlane.setManufacturer("Cessna"); basicPlane.setModel("162 Skycatcher"); basicPlane.setFlightRange(470); basicPlane.setMaxMPHspeed(219);     //********************************************* CommercialAircraft myPlane; myPlane.setManufacturer("BOEING"); myPlane.setModel("737-700"); myPlane.setMaxMPHspeed(544); myPlane.setFlightRange(5510);     //*********************************************       basicPlane.showAll(); myPlane.showAll();   // Assignment 3 code here .... // No need for Assignment 2 to add additional code here   return0; } Aircraft.h: */ Base Aircraft Class */ #ifndef Aircraft_H #define Aircraft_H #include #include using namespace std; const int MANUFACTURER_SIZE = 30; const int MODEL_SIZE = 30; class Aircraft {   private: int maxMPHspeed = 0; int flightRange = 0; int engineCount = 1; bool canCharter = false; string manufacturer; string model;     public: void setMaxMPHspeed(int speed) { maxMPHspeed = speed; } void setFlightRange(int range) { flightRange = range; } void setEngineCount(int engCount) { engineCount = engCount; } void setCanCharter(bool charter) { canCharter = charter; } bool setManufacturer(string data) { if (data.length() <= MANUFACTURER_SIZE) { manufacturer = data; returntrue; } returnfalse; } bool setModel(string data) { if (data.length() <= MODEL_SIZE) { model = data; returntrue; } returnfalse; } int getMaxMPHspeed() const { return maxMPHspeed; } int getFlightRange() const { return flightRange; } int getEngineCount() const { return engineCount; } bool getCanCharter() const { return canCharter; } //Return a string objects string getManufacturer() { string builderName(manufacturer); return builderName; } string getModel() { string modelName(model); return modelName; }     void showAll() { cout << " * Base Aircraft * " << endl; cout << boolalpha; cout << "manufacturer = " << getManufacturer() << endl; cout << "model = " << getModel() << endl; cout << "maxMPHspeed = " << getMaxMPHspeed() << endl; cout << "flightRange = " << getFlightRange() << endl; cout << "engineCount = " << getEngineCount() << endl; cout << "canCharter = " << getCanCharter() << endl << endl;     } }; #endif   CommericialAircraft.h: */ CommercialAircraft Class Derived from Aircraft Class */ #ifndef CommercialAircraft_H #define CommercialAircraft_H #include "Aircraft.h" class CommercialAircraft : public Aircraft { private: int firstClassSeatCount = 0; int businessClassSeatCount = 0; int coachSeatCount = 1; bool hasWIFI = false; public: void setFirstClassSeatCount(int seats) { firstClassSeatCount = seats;}   void setBusinessClassSeatCount(int seats) { businessClassSeatCount = seats;} void setCoachSeatCount(int seats) { coachSeatCount = seats; }   void setHasWIFI(bool wifi) { hasWIFI = wifi; }   int getFirstClassSeatCount() const {return firstClassSeatCount;}   int getBusinessClassSeatCount() const {return businessClassSeatCount;}   int getCoachSeatCount() const {return coachSeatCount;}   bool getHasWIFI() { return hasWIFI; }     void showAll() { cout << " * Commercial Aircraft * " << endl; cout << boolalpha; cout << "manufacturer = " << getManufacturer() << endl; cout << "model = " << getModel() << endl; cout << "maxMPHspeed = " << getMaxMPHspeed() << endl; cout << "flightRange = " << getFlightRange() << endl; cout << "engineCount = " << getEngineCount() << endl; cout << "canCharter = " << getCanCharter() << endl << endl; } }; #endif   Doing the following tasks using the attached code.  1. In the provided AircraftTest program, set the maxMPHspeed to 200 for both the basicPlane and myPlane objects. 2, In both the aircraft and commercialAircraft header files, create virtual methods in both classes named "getMySpeed()".  It should return MPH for the Aircraft base class and KPH (Kilometers per Hour) for Commercial Aircraft. (This implies that the Commercial Aircraft method will convert MPH to KPH); 3. In the provided AircraftTest program, create a single method named mySpeedIs( that is passed the base class by reference (&)).  This method should call the getMySpeed() method for the object passed and display the results. 4. In the main() method in the AircraftTest program, call the above mySpeedIs method using the basicPlane object and then call the mySpeedIs method again passing it the myPlane object for the 2nd call. These should have different results ( one is mph, the other is kph). 5. Change the all Header comments to our standard class header with your name.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

AircraftTest.cpp:

// MS Visual Studio 2015 uses "stdafx.h" - 2017 uses "pch.h"
//#include "stdafx.h"
//#include "pch.h"

//OK if you need to change strcpy to strcpy_s OR use any of these #pragma settings for Visual Studio- Professor Keith
// Visual Studio "fixes" for strcpy
//#define _CRT_SECURE_NO_WARNINGS
//#pragma warning(disable : 4996)
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1



#include <iostream>
#include <string>
#include <cstring>
#include "Aircraft.h"
#include "CommercialAircraft.h"
using namespace std;




int main() {
 
Aircraft basicPlane;
 
basicPlane.setManufacturer("Cessna");
basicPlane.setModel("162 Skycatcher");
basicPlane.setFlightRange(470);
basicPlane.setMaxMPHspeed(219);
 
 
//*********************************************
CommercialAircraft myPlane;
myPlane.setManufacturer("BOEING");
myPlane.setModel("737-700");
myPlane.setMaxMPHspeed(544);
myPlane.setFlightRange(5510);
 
 
//*********************************************
 
 
 
basicPlane.showAll();
myPlane.showAll();
 
// Assignment 3 code here ....
// No need for Assignment 2 to add additional code here
 
return0;
}
Aircraft.h:
*/
Base Aircraft Class

*/

#ifndef Aircraft_H
#define Aircraft_H

#include <cstring>
#include <iostream>

using namespace std;

const int MANUFACTURER_SIZE = 30;
const int MODEL_SIZE = 30;

class Aircraft {
 
private:
int maxMPHspeed = 0;
int flightRange = 0;
int engineCount = 1;
bool canCharter = false;
string manufacturer;
string model;
 
 
public:
void setMaxMPHspeed(int speed) {
maxMPHspeed = speed;
}

void setFlightRange(int range) {
flightRange = range;
}

void setEngineCount(int engCount) {
engineCount = engCount;
}

void setCanCharter(bool charter) {
canCharter = charter;
}

bool setManufacturer(string data) {

if (data.length() <= MANUFACTURER_SIZE) {
manufacturer = data;
returntrue;
}
returnfalse;
}

bool setModel(string data) {
if (data.length() <= MODEL_SIZE) {
model = data;
returntrue;
}
returnfalse;

}

int getMaxMPHspeed() const {
return maxMPHspeed;
}

int getFlightRange() const {
return flightRange;
}

int getEngineCount() const {
return engineCount;
}

bool getCanCharter() const {
return canCharter;
}

//Return a string objects
string getManufacturer() {
string builderName(manufacturer);
return builderName;
}

string getModel() {
string modelName(model);
return modelName;
}
 
 
void showAll() {
cout << " * Base Aircraft * " << endl;
cout << boolalpha;
cout << "manufacturer = " << getManufacturer() << endl;
cout << "model = " << getModel() << endl;
cout << "maxMPHspeed = " << getMaxMPHspeed() << endl;
cout << "flightRange = " << getFlightRange() << endl;
cout << "engineCount = " << getEngineCount() << endl;
cout << "canCharter = " << getCanCharter() << endl << endl;
 
 
}
};

#endif
 
CommericialAircraft.h:
*/
CommercialAircraft Class Derived from Aircraft Class

*/

#ifndef CommercialAircraft_H
#define CommercialAircraft_H


#include "Aircraft.h"

class CommercialAircraft : public Aircraft
{
private:
int firstClassSeatCount = 0;
int businessClassSeatCount = 0;
int coachSeatCount = 1;
bool hasWIFI = false;
public:
void setFirstClassSeatCount(int seats)
{ firstClassSeatCount = seats;}
 
void setBusinessClassSeatCount(int seats)
{ businessClassSeatCount = seats;}

void setCoachSeatCount(int seats)
{ coachSeatCount = seats; }
 
void setHasWIFI(bool wifi) {
hasWIFI = wifi;
}
 
int getFirstClassSeatCount() const
{return firstClassSeatCount;}
 
int getBusinessClassSeatCount() const
{return businessClassSeatCount;}
 
int getCoachSeatCount() const
{return coachSeatCount;}
 
bool getHasWIFI() {
return hasWIFI;
}
 
 
void showAll() {
cout << " * Commercial Aircraft * " << endl;
cout << boolalpha;
cout << "manufacturer = " << getManufacturer() << endl;
cout << "model = " << getModel() << endl;
cout << "maxMPHspeed = " << getMaxMPHspeed() << endl;
cout << "flightRange = " << getFlightRange() << endl;
cout << "engineCount = " << getEngineCount() << endl;
cout << "canCharter = " << getCanCharter() << endl << endl;
}


};

#endif
 

Doing the following tasks using the attached code. 

1. In the provided AircraftTest program, set the maxMPHspeed to 200 for both the basicPlane and myPlane objects.

2, In both the aircraft and commercialAircraft header files, create virtual methods in both classes named "getMySpeed()".  It should return MPH for the Aircraft base class and KPH (Kilometers per Hour) for Commercial Aircraft. (This implies that the Commercial Aircraft method will convert MPH to KPH);

3. In the provided AircraftTest program, create a single method named mySpeedIs( that is passed the base class by reference (&)).  This method should call the getMySpeed() method for the object passed and display the results.

4. In the main() method in the AircraftTest program, call the above mySpeedIs method using the basicPlane object and then call the mySpeedIs method again passing it the myPlane object for the 2nd call. These should have different results ( one is mph, the other is kph).

5. Change the all Header comments to our standard class header with your name.

Deliverable is the CPP program and 2 Header files.

 

 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Image Element
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education