< previous page page_442 next page >

Page 442
// crew members. Global constant PERSON_WT is used as the weight
// of each crew member

// Precondition:
//    crew == 1 OR crew == 2
// Postcondition:
//    Function value == Crew moment arm, based on the crew parameter

{
    const float CREW_DISTANCE = 143.0;  // Distance to crew seats
                                        //   from front

    return float(crew) * PERSON_WT * CREW_DISTANCE;
}

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

float PassengerMoment( /* in */ int passengers )   // Number of
                                                   //   passengers

// Computes the passenger moment arm in inch-pounds from the number
// of passengers. Global constant PERSON_WT is used as the weight
// of each passenger. It is assumed that the first two passengers
// sit in row 2, the second two in row 1, the next two in row 3,
// and remaining passengers sit in row 4

// Precondition:
//     0 <= passengers <= 8
// Postcondition:
//     Function value == Passenger moment arm, based on the
//                       passengers parameter

{
    const float ROW1_DIST = 219.0;  // Distance to row 1 seats
                                    //   from front
    const float ROW2_DIST = 265.0;  // Distance to row 2 seats
    const float ROW3_DIST = 295.0;  // Distance to row 3 seats
    const float ROW4_DIST = 341.0;  // Distance to row 4 seats

    float moment = 0.0;             // Running total of moment as
                                    //   rows are added

    if (passengers > 6)                    // For passengers 7 and 8
    {
        moment = moment +
                 float(passengers - 6) * PERSON_WT * ROW4_DIST;
        passengers = 6;                    // 6 remain

 
< previous page page_442 next page >