|
|
|
|
|
|
|
off. If its center of gravity is outside the limits established for the plane, it might be impossible to control. Either situation can lead to a crash. You have been asked to write a program that determines the weight and center of gravity of this new plane, based on the number of crew members and passengers as well as the weight of the baggage, closet contents, and fuel. |
|
|
|
|
|
|
|
|
The Beechcraft Starship-1 |
|
|
|
|
|
|
|
|
Input: Number of crew members, number of passengers, weight of closet contents, baggage weight, fuel in gallons. |
|
|
|
|
|
|
|
|
Output: Total weight, center of gravity. |
|
|
|
|
|
|
|
|
Discussion: As with most real-world problems, the basic solution is simple but is complicated by special cases. We use value-returning functions to hide the complexity so that the main function remains simple. |
|
|
|
|
|
|
|
|
The total weight is basically the sum of the empty weight of the airplane plus the weight of each of the following: crew members, passengers, baggage, contents of the storage closet, and fuel. We use the standard average weight of a person, 170 pounds, to compute the total weight of the people. The weight of the baggage and the contents of the closet are given. Fuel weighs 6.7 pounds per gallon. Thus, the total weight is |
|
|
|
|
|