Class Throttle
A Throttle object simulates a throttle that is controlling fuel flow
Constructor
public Throttle(int size)
Parameters
size, the number of on positions
Precondition
Postcondition
Throttle initialized with specified # of on positions; initially off
Throws
Constructor
public Throttle( )
Postcondition
Throttle initialized with 5 on positions; initially off
Throws
getFlow
public double getFlow( )
Get the current flow of this Throttle
Returns
isOn
public boolean isOn( )
Check whether Throttle is on
Returns
If Throttle flow is above zero, returns true; otherwise returns false
shutOff
public void shutOff( )
Postcondition
The Throttle's flow is shut off
shift
public void shift(int amount)
Move Throttle position up or down
Postcondition
Throttle's position has been moved by amount. If result is more than top
position, then position set to top. If result is less than zero position, then
position set to zero.