|
|
|
|
|
|
|
float FuelMoment( /* in */ int fuel ) // Fuel in gallons
// Computes the moment arm for fuel on board. There are four
// different formulas for this calculation, depending on
// the amount of fuel, due to fuel tank layout.
// This function uses the global constant LBS_PER_GAL
// to compute the weight of the fuel
// Precondition:
// 10 <= fuel <= 565
// Postcondition:
// Function value == Fuel moment arm, based on the
// fuel parameter
{
float fuelWt; // Weight of fuel in pounds
float fuelDistance; // Distance from front of plane
fuelWt = float(fuel) * LBS_PER_GAL;
if (fuel << 60)
fuelDistance = float(fuel) * 314.6;
else if (fuel << 361)
fuelDistance = 305.8 + (-0.01233 * float(fuel - 60) );
else if (fuel << 521)
fuelDistance = 303.0 + ( 0.12500 * float(fuel - 361) );
else
fuelDistance = 323.0 + (-0.04444 * float(fuel - 521) );
return fuelDistance * fuelWt;
}
//******************************************************************
void PrintWarning()
// Warns the user of assumptions made by the program
// and when to double check the program's results
// Postcondition:
// An informational warning message has been printed
{
cout << endl
<< Notice: This program assumes that passengers << endl
<< fill the seat rows in order 2, 1, 3, 4, and << endl
<< that each passenger and crew member weighs
<< PERSON_WT << pounds. << endl
<< It also assumes that Jet-A fuel weighs
<< LBS_PER_GAL << pounds << endl
<< per U.S. gallon. The center of gravity endl
|
|
|
|
|
|