< previous page page_440 next page >

Page 440
const float PERSON_WT = 170.0;          // Average person weighs
                                        //   170 lbs.
const float LBS_PER_GAL = 6.7;          // Jet-A weighs 6.7 lbs.
                                        //   per gal.
const float EMPTY_WEIGHT = 9887.0;      // Standard empty weight
const float EMPTY_MOMENT = 3153953.0;   // Standard empty moment

float CargoMoment( int, int );
float CrewMoment( int );
float FuelMoment( int );
void GetData( int&, int&, int&, int&, int& );
float PassengerMoment( int );
void PrintWarning();

int main()
{
    int crew;              // Number of crew on board (1 or 2)
    int passengers;        // Number of passengers (0 through 8)
    int closet;            // Weight in closet (160 lbs. maximum)
    int baggage;           // Weight of baggage (525 lbs. max.)
    int fuel;              // Gallons of fuel (10 through 565 gals.)
    float totalWt;         // Total weight of the loaded Starship
    float centerOfGravity; // Center of gravity of loaded Starship

    cout.setf(ios::fixed, ios::floatfield);   // Set up floating pt.
    cout.setf(ios::showpoint);                // output format

    GetData(crew, passengers, closet, baggage, fuel);

    totalWt =
        EMPTY_WEIGHT + float(passengers + crew) * PERSON_WT +
        float(baggage + closet) + float(fuel) * LBS_PER_GAL;
    centerOfGravity =
        (CrewMoment(crew) + PassengerMoment(passengers) +
        CargoMoment(closet, baggage) + FuelMoment(fuel) +
        EMPTY_MOMENT) / totalWt;

    cout << Total weight is  << setprecision(2) << totalWt
         <<  pounds. << endl;
    cout << Center of gravity is  << centerOfGravity
         <<  inches from the front of the plane. <<  endl;
    PrintWarning();
    return 0;
}

//******************************************************************

 
< previous page page_440 next page >