Electrical and Computer Engineering
19 of 24
UAH
CPE 112
Case Study Implementation
•float CrewMoment( /*in*/ int crew )  // Number of crew members
•
•// Computes the crew moment arm in inch-pounds from the number of
•// 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;
•}