Electrical and Computer Engineering
20 of 24
UAH
CPE 112
Case Study Implementation
•float PassengerMoment( /*in*/ int passengers )
•{
•    const float ROW1_DIST = 219.0;  // Distance to row 1 seats
•    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
• if (passengers > 6)             // For passengers 7 and 8
•    { 
•        moment = moment + float (passengers - 6) *
•                 PERSON_WT * ROW4_DIST;
•        passengers = 6;                    // 6 remain
•    }
•    if (passengers > 4)              // For passengers 5 and 6
•           .
•           .
•           .
•    return moment;
•}