For an assignment I have to write code for a "State" class that has all the attributes about position of an airplane.
The Javadoc is already written up and must be strictly adhered to. All the set methods are public but must throw an exception if any class other than Airplane try to use them.
I can't change the structure of either class at all or the visibility. My professor said to use either a "clone" or a boolean somehow. How would I go about doing this?
public void setSpeed(double speed)
{
if(method called by any class other than Airplane.java)
{
//throw exception
}
else
{
//continue setting speed
}
}