When using real numbers never do exact tests like xPos != 0.0 because precision might result in a number like 0.00000001 or -0.00000001 instead of 0.0. It is good programming practice do use...