I really need help creating this program, i am not very good at coding and you all would be a blessing to help me. Thanks in advance!

Assignment
Create an Aircraft class that has several properties that are common to all aircraft (Ex: number of
engines, seat capacity). You define the name of the Class and the actual fields. The fields MUST
BE PRIVATE!!! You must define a constructor that allows you to provide at least some of the
field values used for an aircraft. You must define a printCharacteristics() method.
Create three subclasses for specialized types of aircraft. An example might be a Fighter, Acrobat,
and Freight. You do not have to use these three choices. You define the names of the classes.
Each specialized craft should have additional properties that are common to just that type of
specialized craft. These fields MUST BE PRIVATE. For each derived class, you must define a
constructor that allows you to provide at least some of the field values used for these subclass
aircraft. You must define any getter/setter methods you need.
Make a SINGLE C++ vector of Aircraft pointers. You will populate this list by reading
commands from an input file. This vector will hold pointers to any type of Aircraft including your
three derived classes.
The commands in the file will cause you to create your Aircraft objects or print them using the
printCharacteristics() method. This method must be overridden in each subclass.
The output should print a well formatted description of all the specific and inherited information
for each craft. (Make sure you up on virtual functions and virtual destructors).

CS 1337.503 15F Program #4 Page 2 of 4
Requiremements
 Your code must exhibit the use of Polymorphism.
Do not create separate arrays for objects of each class.  Your code must exhibit the use of subclasses
 Your code must exhibit the use of overridden methods
 Your code must exhibit the use of a parameterized STL vector
Deliverables
You must submit your homework through ELearning. You must include UML diagrams of your
classes, a Class Hierarchy diagram, your .h and .cpp files, and a commented version of your input
file.
Notes
No late homework is accepted.
Input File Format
The input file is a text file that contains an unknown number of commands. Commands are
strings that determine what operations should be performed. If the commands have arguments,
they are listed after the command. Multiple arguments will be comma separated. Spaces, tabs,
and anything following // can be ignored.
This assignment requires you to create 4 separate classes: your aircraft class, your subclass 1,
your subclass2, and your subclass 3. In the commands section of the file, these classes will be
referred to by number:
Class Referred to using
Your Aircraft Class 0
Your subclass 1 1
Your subclass 2 2
Your subclass 3 3
The commands all have to do with creating aircraft and printing information about those aircraft.
Since you are defining your own classes and subclasses, you will also have to define the
arguments that go with the commands. Your commands must provide enough information so that
you can execute them. The commands are:

CS 1337.503 15F Program #4 Page 3 of 4
String Command Description
n Create a new aircraft. The first arg is the aircraft type. You
must define the rest of the arguments needed to create
your aircraft of that type:
int aircraft type (from the "Referred to using")
... (you define the rest for each aircraft type)
Each aircraft should be placed in the aircraft vector. The
first aircraft you create will be numbered 1, the second 2,
etc...
p Print the characteristics of an aircraft in your list. This
command takes one argument which represents the actual
Aircraft to print. If the argument has the value 0, you print
information for all the aircraft. Otherwise, just print the
information for the single aircraft referred. Remember, the
first Aircraft created is numbered 1.
Your code must check for proper information for each command. Errors should be handled by
printing a message and ignoring the line. Examples of errors include, but are not limited to:
unknown commands, commands without the proper number of arguments, commands with
arguments that do not make sense, and commands that have the wrong types of arguments.
An example file would be:

// Commands information:
//   n ‐ create a new aircraft. If the first arg is 0, then parameters are
//    int: number of engines
//    int: seat capacity
//
// if the first arg is 1, then the parameters are:
//    int: number of engines
//    int: seat capacity
//    String: range and speed description
//
// if the first arg is 2 then the parameters are:
//    String: Manufacturer
//    String: Performance capability description
//
// if the first arg is 3 then the parameters are:
//    int: number of engines
//    String: Freight Company
//    String: Cargo Capacity
n 0, 2, 6 // New Aircraft: 2 engines, seats 6
n 0, 4, 200 // New Aircraft: 4 engines, seats 200 
CS  1337.503    15F  Program    #4      Page    4   of  4
n 1, 1, 1, "Top Speed: Mach 1.2, Max Range: 400 Miles"
n 1, 2, 2, "Top Speed: Mach 2, Max Range: 1200 Miles"
n 2, "Zivko Edge 540", "Cruise: 333 km/h, Max Roll Rate: 420 degrees/sec, G-limit: 10"
n 2, "Pitts Special S-1S", "180HP, certified S-1C for competition aerobatics"
n 3, 4, "UPS", "100 UPS Shipping containers"
n 3, 4, "FedEx", "14,000 pounds"
p 0
p 1
p 2
p 3

Recommended Answers

All 5 Replies

I wonder if you are taking Dr. Stephen Perkins class on this. He says you can call him during office hours if needed.

Yes well, i live 45 minutes away from campus so after class i have to go straight home and dont get home till 9. lol

Dr. Stephen Perkins also handed out his email address for those that can't call.

In the absence of further information, should we assume you spoke to the professor and all is right in the world, or did you still need help, and if the latter, what problems are you experiencing?

This related demo may help you to get started ...

// airCraft.cpp //

#include <iostream>

using namespace std;

class AirCraft
{
public:
    AirCraft( int e = 1 , int s = 1 ) : engines(e), seats(s) {}
    int get_engines() const { return engines; }
    int get_seats() const { return seats; }

    virtual ~AirCraft() { cout << "AirCraft dtor was called ...\n"; }

    virtual void print() const = 0;
private:
    int engines;
    int seats;
} ;


class Fighter : public AirCraft
{
public:
    Fighter( int e=1, int s=1, int g = 1 ) : AirCraft::AirCraft( e, s ), guns(g) {}

    ~Fighter() { cout << "Fighter dtor was called ...\n"; }

    void print() const
    {
        cout << "engines = " << get_engines()
             << ", seats = " << get_seats()
             << ", guns = " << guns << endl;
    }
private:
    int guns;
} ;

class Freight : public AirCraft
{
public:
    Freight( int e=2, int s=2, int w = 2000 ) : AirCraft::AirCraft( e, s ), lbs(w) {}

    ~Freight() { cout << "Freight dtor was called ...\n"; }

    void print() const
    {
        cout << "engines = " << get_engines()
             << ", seats = " << get_seats()
             << ", lbs = " << lbs << endl;
    }
private:
    int lbs;
} ;



void test_it_out()
{
    AirCraft* a [10];
    a[0] = new Fighter();
    a[1] = new Freight( 4, 2, 10000 );

    a[0]->print();
    a[1]->print();

    delete a[1];
    delete a[0];
}

int main()
{
    test_it_out();
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.