Assigned | Monday April 12, 2004 |
Design Due | Sunday April 18, 2004 at 11:59pm |
Program Due | Sunday April 25, 2004 at 11:59pm |
Updates | 18 April
The project description states that you may alter the order of parameters for your functions. This IS NOT TRUE for constructors since Proj4.cpp will assume you have followed the parameter order specified in the project description 16 April
|
Since all planes have common attributes and perform common functions, it's natural to design these planes in an inheritance hierarchy with a generic AirCraft class at the top.
For our small project, we have identified these attributes which are common to all aircraft
It is NOT necessary to dynamically allocate data members of any class for this
project. If you have a working version of project 3 that does not use dynamic
memory allocation, that would be a good place to start.
FlyMission() is a pure virtual function which MUST be implemented
in each derived class. Because AirCraft contains at least one pure virtual function, it is
an "abstract" base class (aka "ABC") and it is therefore not possible to instantiate
AirCraft objects.
The AirCraft class supports the following interface. No other public functions are
permitted. The "const"ness of these functions is not specified and is left to you.
A complete description of the command files is given below.
In addition to the public functions defined for the AirCraft class,
the CargoPlane class interface is defined by these public functions.
It may also be necessary to override and/or use one or more functions from the AirCraft class
as part of the CargoPlane interface.
The Cargo class interface is defined by these public functions:
The AirCraft class
The AirCraft class is the base class for our hierarchy. The class provides
the interface for all common aircraft actions listed above. All actions
are implemented in the AirCraft class as virtual functions to provide the default aircraft behavior.
For some actions, the derived classes will override or extend the default behavior and for some
actions, the default behavior defined in the AirCraft class is sufficient.
"LOAD", "UNLOAD", "PRINT", "QUIT", "CLIMB", "DESCEND", "LAND", "TAKEOFF"
The CargoPlane class
The CargoPlane class models a single plane which contains zero or more
Cargo containers and many additional attributes.
The CargoPlane in this project does not use
a FlightTable, nor calculate fuel usage, hours, or mileage. Unused code may
be deleted or kept at your discretion.
Changes/additions to the CargoPlane interface are
highlighted with .
You may choose to use the UnLoadCargo() function from project 2, or
operator-=(Cargo) from the project 3 extra credit instead of operator-=.
The Cargo Class
This class models a single cargo container. The Cargo class is unchanged from project 3,
although dynamic memory allocation of data members is not required.
As in project 3, Cargo containers are uniquely identified by their label
and you may assume that no two containers have the same label.
operator<<
must be overloaded as a friend of the Cargo class.
operator<< prints all attributes of the cargo container in a format
consistent with the sample output.
The Commuter class interface is defined by these public functions. No other public functions are permitted. It may also be necessary to override and/or use one or more functions from the AirCraft class as part of the Commuter interface.
The Tanker class interface is defined by these public functions. No other public functions are permitted. It may also be necessary to override and/or use one or more functions from the AirCraft class as part of the Tanker interface.
As in project 3, each command and each data item will be on a separate line in the file. The format of the PRINT, LAND, TAKEOFF, CLIMB, DESCEND and QUIT commands are identical for all aircraft. Sample command files are available in Mr. Frey's public directory.
The format for LOAD and UNLOAD is different for each aircraft
This file WILL BE DELETED and REPLACED with a new Proj4.cpp for grading. DO NOT make any changes to this file that might cause compiler/linker errors when it's replaced with the new Proj4.cpp. E.g. do not change the names of functions or add/remove #includes.
It is not necessary that you follow their format exactly, but whatever format you choose must provide all required information, including tabular form for the cargo data.
Required formatting is the same as project 3.
The "make" utility is used to help control projects with large numbers of files. It consists of targets, rules, and dependencies. You will be learning about make files in discussion. For this project, examine and understand the makefile for project 2, then modify it for project 3.
When you want to compile and link your program, simply type the command make or make Proj4 at the Linux prompt. This will compile Proj4.cpp, CargoPlane.cpp, Cargo.cpp, AirCraft.cpp, Tanker.cpp, and Commuter.cpp create the executable named Proj4. Your executable MUST be named Proj4 as that name is used in the testing/grading scripts.
The make utility can also be used for compiling a single program without linking. For example, to compile Cargo.cpp, type make Cargo.o.
In addition to compiling and linking your files, make can be used for maintaining your directory. Typing make clean will remove any extraneous files in your directory, such as .o files and core files. Typing make cleanest will remove all .o files, core, Proj1, and backup files created by the editor. More information about these commands can be found at the bottom of the makefile.
The grade for this project will be broken down as follows. A more detailed breakdown will be provided in the grade form you receive with your project grade.
You can check to see what files you have submitted by typing
More complete documentation for submit and related commands can be found here.
Remember -- if you make any change to your program, no matter how insignificant it may seem, you should recompile and retest your program before submitting it. Even the smallest typo can cause compiler errors and a reduction in your grade.
Avoid unpleasant surprises!
Be sure to use the submitmake and submitrun utilities provided
for you to compile, link and run your program after you've submitted it.