2003 AITP National Collegiate Conference

C++ Problem Statement

 

Phase 1 Process File

You will read a file that contains information about aircraft and cargo.

 Input format
        The aircraft record will have the following format:
        <plane-type><num of engines><cargo capable><max weight>

Plane-type will be limited to: prop, or jet (space padded 4 bytes)
        Num of engines will be an integer (zero padded 4 bytes)
        Cargo-Type will be limited to: y or n (one byte)
        Max Weight will be an integer (zero padded 4 bytes)

The cargo record will have the following format:
        <cargo-type><weight>

Cargo Type will be limited to: m or f (for mail or freight)
        Weight will be an integer (zero padded 4 bytes)

 Sample Data

<prop><0004><y><0800>
        <jet ><0002><y><1600>
        <f><0500>
        <m><0300>

You will load these objects from file into their corresponding object types (airplane or
        cargo).  The data file will be named objects.dat.

Phase 2: Create the free-floating function void loadPlanes (Plane[] p, Cargo[] c);

1.        Load the freight onto the planes (does the plane have enough capacity to carry entire cargo load.  If so

add it to the plane and decrement the cargo object). The function should minimize any remaining cargo that could not be loaded.

Phase 3: Create the free-floating function void printPlanes (Plane[] p); 

1.        Have the planes print out the following details
a.        Tell what kind of plane it is.
b.       Tell the number of engines.
c.        Tell the amount of carried cargo and remaining weight capacity

 The output should look like:

Prop with 2 engines carrying 400 pounds of freight with 100 pounds of capacity left.

Phase 4: Create the free-floating function void printRemainCargo (Cargo[] c);

This function will tell if there is any remaining cargo that could not be loaded on plane

 The output should look like:

The freight item weighting 5000 lbs. could not be loaded
The mail item weighting 10000 lbs. could not loaded