A primary limitation of fighter plane performance is the ability of the
pilot to remain conscious. We have determined that pilots can withstand large
accelerations for short time periods, but that they cannot handle an
extended time period during which the average acceleration is high.
Create a class GForce that contains a method avgAccel that will be given the
period as an int, and int[]'s accel and time
giving a piecewise-linear
approximation to the acceleration experienced over time during a flight.
The method will return the greatest average acceleration experienced over any
interval of length equal to
period. The return value should be the average acceleration as a double.
The piecewise-linear acceleration function is given in order of increasing
times, starting with the beginning of the flight and ending at the end of the
flight. The graph of acceleration versus time is the sequence of straight-line
segments joining adjacent points (timei, acceli).
The average acceleration over an interval is the area under the graph between
the beginning and ending times, divided by the length of the interval.
|