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 output. I included the Header files included in the instructions.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Airplane Fleet Application Program This project involves designing and creating a C++ program that contains three C++ classes and uses inheritance, as described below. The base class (parent class) is the Airplane class. The CargoPlane and PassengerPlane classes are derived classes (child classes) of the Airplane class. A UML diagram of this class relationship is shown below: It is important to note that this is NOT multiple inheritance. CSC237_Project3 20231115.docx 11/15/2023 11:22 AM page 1 of 14 CSC237 Project 3: Airplane Fleet Due Date: December 13,2023 Design Requirements 1. The program must be designed using the three classes that are described in the previous section of this document. Any submission that does not conform to this requirement will receive a grade of ZERO. 2. The program must be organized as a "Command Loop" program, similar to the Command Loop sample program that we discussed during an earlier class. (Refer to the Ch06_sample_code_CommandLoop... resource in the Sample Code section of Moodle.) 3. The program must implement the following interactive commands: \begin{tabular}{|c|c|} \hline & Add a new airplane to the fleet. \\ \hline & Fly a plane in the fleet. \\ \hline & print Help text. \\ \hline & Print current fleet information. \\ \hline & Quit (end the program). \\ \hline & Remove airplane from the fleet \\ \hline \end{tabular} (Specific requirements for each command are stated in the Requirements for Interactive Commands section of this document.) 4. The program must create a vector of pointers to Airplane objects: the main function must have a local variable defined as shown here: vector fleet; The fleet vector becomes an argument for the functions that process each of the user commands. 5. Each Airplane object must be dynamically allocated (using the C++ new operation) when the user executes the "a" command. Class Specification Files (provided with the assignment) There are three class specification files (Airplane.h, CargoPlane.h, and PassengerPlane.h) provided to the student as part of the project assignment. Ideally the student should not need to modify these files in order to complete the project. Obviously, if the student does modify any of these files, then the modified versions must be submitted to Moodle with the rest of the source code files. Airplane.h This file declares the member variables and functions of the Airplane class. The actual code is included in this file for the destructor function only. The student must implement code for the constructor functions and for other member functions in the Airplane.cpp file. CargoPlane.h This file declares the member variables and functions of the CargoPlane class. The actualeade is included in this file for the constructor and destructor functions only. The student must implement code for the other member functions in the CargoPlane.epp file. PassengerPlane.h This file declares the member variables and functions of the PassengerPlane class. The actual code is included in this file for the constructor and destructor functions only. The student must implement code for other member functions in the PassengerPlane.cpp file. CSC237_Project3_20231115.docx 11/15/2023 11:22 AM page 3 of 14 CSC237 Project 3: Airplane Fleet DueDate:December13,2023 Sample Interactive Session In the sample data on the next several pages, what the user types is shown in bold font. In actuality, what the user types would have the same text format as the rest of the output. CSC237_Project3 20231115.docx 11/15/2023 11:22 AM page 4 of 14 CSC237 Project 3: Airplane Fleet Due Date: December 13,2023 Sample Interactive Session Which airplane do you want to fly? 0 Length of flight (hours)? 12 Airplane 0 not found. Enter command (or ' h ' for help) : a Enter type of airplane ( c= cargo, p= passenger ) : C Enter name of manufacturer: Boeing Enter model: B747-400F Enter year built: 1996 Enter flight hours: 73200 Enter maximum cargo weight: 102500 New airplane : ID: 1, manufacturer: Boeing, model: B747-400F, year: 1996, Enter maximum cargo weight: 102500 New airplane : IDA: 1, manufacturer: Boeing, model: B747-400F, year: 1996, hours: 73200, max cargo: 102500 addNewAirplane: Size of fleet - 1 Enter command (or ' h ' for help): p Current fleet contains 1 airplane (s) : IDF: 1, manufacturer: Boeing, model: B747-400F, year: 1996, hours: 73200, max cargo: 102500 Enter command (or ' h ' for help): a Enter type of airplane (c - cargo, p - passenger) : p Enter name of manufacturer: Lockeed Enter model: L-1011 Enter year built: 1992 Enter flight hours: 85300 Enter maximum Passenger count: 160 New airplane : IDA: 2, manufacturer: Lockeed, model: L-1011, year: 1992, hours: 85300, max passengers: 160 addNewAirplane: Size of fleet =2 Enter command (or ' h ' for help): p Current fleet contains 2 airplane (s): IDF: 1, manufacturer: Boeing, model: B747-400E, year: 1996, hours: 73200, max cargo: 102500 ID: 2, manufacturer: Lockeed, model: L-1011, year: 1992, hours: 85300, max passengers: 160 Enter command (or ' h ' for help): a Enter type of airplane (c - cargo, p - passenger) : p Enter name of manufacturer: Airbus Enter model: A-350 Enter year built: 2004 Enter flight hours: 53200 Enter maximum Passenger count: 205 New airplane : IDA: 3, manufacturer: Airbus, model: A-350, year: 2004, hours: 53200 , max passengers: 205 addNewAirplane: Size of fleet - 3 Enter command (or ' h ' for help): p CSC237_Project3_20231115.docx 11/15/2023 11:22 AM page 5 of 14 CSC 237 Project 3: Airplane Fleet Due Date: December 13,2023 Sample Interactive Session Current fleet contains 3 airplane(s) : IDf: 1, manufacturer: Boeing, model: B747-400F, year: 1996, hours: 73200, max cargo: 102500 IDF: 2, manufacturer: Lockeed, model: L-1011, year: 1992, hours: 85300, max passengers: 160 IDF: 3, manufacturer: Airbus, model: A-350, year: 2004, hours: 53200, max passengers: 205 Enter command (or ' h ' for help): a Enter type of airplane (c - cargo, p - passenger) : c Enter name of manufacturer: Boeing Enter model: B777-200F Enter year built: 2008 Enter flight hours: 44607 Enter maximum cargo weight: 225000 New airplane : ID\#: 4, manufacturer: Boeing, model: B777-200F, year: 2008, hours: 44607, max cargo: 225000 addNewAirplane: Size of fleet - 4 Enter command (or ' h ' for help): p Enter name of manufacturer: Cessna Enter model: C185 Enter year built: 2003 Enter flight hours: 8500 Enter maximum Passenger count: 6 New airplane : ID\#: 5, manufacturer: Cessna, model: C-185, year: 2003, hours: 8500 , max passengers: 6 addNewAirplane: Size of fleet -5 Enter command (or ' h ' for help): p Current fleet contains 5 airplane (s) : IDf: 1, manufacturer: Boeing, model: B747-400F, year: 1996, hours: 73200, max cargo: 102500 IDf: 2, manufacturer: Lockeed, model: L-1011, year: 1992, hours: 85300, max passengers: 160 IDf: 3, manufacturer: Airbus, model: A-350, year: 2004, hours: 53200, max passengers: 205 IDf: 4, manufacturer: Boeing, model: B777-200F, year: 2008, hours: 44607, max cargo: 225000 CSC237_Project3_20231115.docx 11/15/2023 11:22 AM page 6 of 14 CSC237 Project 3: Airplane Fleet Due Date: December 13,2023 Sample Interactive Session IDf: 5, manufacturer: Cessna, model: C-185, year: 2003, hours: 8500, max passengers: 6 Enter command (or ' h ' for help): f Which airplane do you want to fly? 3 Length of flight (hours)? 34 Choosing airplane: IDA: 3, manufacturer: Airbus, model: A-350, year: 2004, hours: 53200, max passengers: 205 Flight complete: ID\#: 3, manufacturer: Airbus, model: A-350, year: 2004, hours: 53234, max passengers: 205 Enter command (or ' h ' for help): p Current fleet contains 5 airplane(s) : IDF: 1, manufacturer: Boeing, model: B747-400F, year: 1996, hours: 73200, max cargo: 102500 ID 1 2, manufacturer: Lockeed, model: L-1011, year: 1992, hours: 85300, max passengers: 160 ID 1 : 3, manufacturer: Airbus, model: A-350, year: 2004, hours: 53234, max passengers: 205 ID\#: 4, manufacturer: Boeing, model: B777-200F, year: 2008, hours: 44607, max cargo: 225000 ID 1 5, manufacturer: Cessna, model: C-185, year: 2003, hours: 8500, max passengers: 6 Enter command (or ' h ' for help): f Which airplane do you want to fly? 8 Length of flight (hours)? 18 Airplane 8 not found. Enter command (or ' h ' for help): f Which airplane do you want to fly? 2 Length of flight (hours)? 100 Choosing airplane: ID $ : 2, manufacturer: Lockeed, model: L-1011, year: 1992, hours: 85300, max passengers: 160 Flight complete: ID\#: 2, manufacturer: Lockeed, model: L-1011, year: 1992, hours: 85400, max passengers: 160 Enter command (or ' h ' for help): p Current fleet contains 5 airplane (s): ID : : 1, manufacturer: Boeing, model: B747-400F, year: 1996, hours: 73200, max cargo: 102500 ID 1 2, manufacturer: Lockeed, model: L-1011, year: 1992, hours: 85400, max passengers: 160 ID: 3, manufacturer: Airbus, model: A-350, year: 2004, hours: 53234, max passengers: 205 IDF: 4, manufacturer: Boeing, model: B777-200F, year: 2008, hours: 44607, max cargo: 225000 ID\#: 5, manufacturer: Cessna, model: C-185, year: 2003, hours: 8500, max passengers: 6 Enter command (or ' h ' for help): f Which airplane do you want to fly? 1 Length of flight (hours)? 7 CSC237_Project3_20231115.docx 11/15/2023 11:22 AM page 7 of 14 CSC237 Project 3: Airplane Fleet Due Date: December 13,2023 Sample Interactive Session Choosing airplane: IDf: 1, manufacturer: Boeing, model: B747-400F, year: 1996, hours: 73200, max cargo: 102500 Flight complete: ID\#: 1, manufacturer: Boeing, model: B747-400F, year: 1996, hours: 73207, max cargo: 102500 Enter command (or ' h ' for help): p Current fleet contains 5 airplane (s) : ID: 1, manufacturer: Boeing, model: B747-400F, year: 1996, hours: 73207, max cargo: 102500 IDF: 2, manufacturer: Lockeed, model: L-1011, year: 1992, hours: 85400, max passengers: 160 IDf: 3, manufacturer: Airbus, model: A-350, year: 2004, hours: 53234, max passengers: 205 ID: 4, manufacturer: Boeing, model: B777-200F, year: 2008, hours: 44607, max cargo: 225000 ID: 5, manufacturer: Cessna, model: C-185, year: 2003, hours: 8500, max passengers: 6 Enter command (or ' h ' for help): f Which airplane do you want to fly? 5 Length of flight (hours)? 4 Choosing airplane: ID : 5, manufacturer: Cessna, model: C-185, year: 2003, hours: 8500, max passengers: 6 Flight complete: ID\#: 5, manufacturer: Cessna, model: C-185, year: 2003, hours: 8504, max passengers: 6 Enter command (or ' h ' for help): p Current fleet contains 5 airplane (s): IDf: 1, manufacturer: Boeing, model: B747-400F, year: 1996, hours: 73207, max cargo: 102500 IDF: 2, manufacturer: Lockeed, model: L-1011, year: 1992, hours: 85400, max passengers: 160 IDf: 3, manufacturer: Airbus, model: A-350, year: 2004, hours: 53234, max passengers: 205 ID: 4, manufacturer: Boeing, model: B777-200F, year: 2008, hours: 44607, max cargo: 225000 ID: 5, manufacturer: Cessna, model: C-185, year: 2003, hours: 8504, max passengers: 6 Enter command (or ' h ' for help): r Which airplane do you want to remove? 6 Airplane 6 not found. Enter command (or ' h ' for help): p Current fleet contains 5 airplane (s) : IDf: 1, manufacturer: Boeing, model: B747-400F, year: 1996, hours: 73207, max cargo: 102500 ID: 2, manufacturer: Lockeed, model: L-1011, year: 1992, hours: 85400, max passengers: 160 IDF: 3, manufacturer: Airbus, model: A-350, year: 2004, hours: 53234, max passengers: 205 IDf: 4, manufacturer: Boeing, model: B777-200F, year: 2008, hours: 44607, max cargo: 225000 // Specification file for the PasengerPlane Class \#ifndef PASSENGER_PLANE_H \#define PASSENGER_PLANE_H \#include \#include \#include \#include "Airplane.h" using namespace std; Gclass PassengerPlane : public Airplane \{ private: int maxNumberofPassengers; // Maximum number of passengers public: // Default constructor PassengerPlane() : Airplane() \{ maxNumber0fPassengers =0; \} // Constructor PassengerPlane(string manufacturer, string model, int yearBuilt, int flightHours, int maxNumberOfPassengers) : Airplane( manufacturer, model, yearBuilt, flightHours) \{ this maxNumberofPassengers = maxNumber0fPassengers; \} virtual PassengerPlane() \{ cout "Destructor for PassengerPlane " this->getAirplane_ID() en \} // Mutators void setMaxNumberofPassengers (int passengers); static PassengerPlane* addNewPassengerPlane(); // Accessors int getMaxNumberofPassengers() const; virtual string getDescription() const; \}; // Specification file for the Airplane class ifndef AIRPLANE_H \#define AIRPLANE_H \#include \#include finclude using namespace std; =lass Airplane orivate: 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. sublic: // 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; ; fendif Specification file for the CargoPlane Class fndef CARGO_PLANE_H efine CARGO_PLANE_H nclude nclude nclude nclude "Airplane.h" ing namespace std; ass CargoPlane : public Airplane ivate: int naxCargoleight; // Maximum weight of cargo blic: // Constructors CargoPlane() : Airplane() \{ maxCargoWeight =0; \} Cargoplane(string manufacturer, string model, int yearBuilt, int flightHours, int maxCargowleight) : 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 getMaxCargoWleight() const; virtual string getDescription() const

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

Beginning VB 2008 Databases

Authors: Vidya Vrat Agarwal, James Huddleston

1st Edition

1590599470, 978-1590599471

More Books

Students also viewed these Databases questions