The problem is solved. using
myBalloon.adjustAltitude(myBalloon.getAltitude() - 100); would mean add the altitude to itself (doubling it) then subtracting 100. by jusing
myBalloon.adjustAltitude(...
Type: Posts; User: Pinares
The problem is solved. using
myBalloon.adjustAltitude(myBalloon.getAltitude() - 100); would mean add the altitude to itself (doubling it) then subtracting 100. by jusing
myBalloon.adjustAltitude(...
It just replaces the altitude to w.e is in the argument. The current altitude at the time of that first statement is 250, and when i subtract 100 it gives me 400 in the output.
I posted the class definition. The adjustAltitude method adjusts the altitude to w.e. i put it as long as its > 0. When I call it in the statement
myBalloon.adjustAltitude(myBalloon.getAltitude() -...
its on a different file in my src folder.
--- Update ---
When I replace the adjustAltitude methods in
myBalloon.adjustAltitude(myBalloon.getAltitude() - 100); and ...
It gave me wrong outputs.
the blue should produce that the first balloon's alt is 250 - 100, 150. instead it gives 400, and the next should say its alt is at the same, instead it stays at its own.