Electrical and Computer Engineering
17 of 24
UAH
CPE 112
Case Study Implementation
•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. Max.)
•    int   baggage;       // Weight of baggage (525 lbs. max.)
•    int   fuel;          // Gallons of fuel (10 - 565 gals.)
•    float totalWt;       // Total weight of loaded Starship
•    float centerOfGravity; // Center of gravity of loaded Ship
•    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;
•