Arduino is closer to C than Java but yes, program logic is to just cycle quickly through the loop,
If the upper float is active set the pump value to start
If the lower float goes inactive set pump value to stop
If nothing else happening leave the value alone.
Then output the motor state
wait a bit to let Arudino do background stuff and let physical world catch up with program actions.
Key thing is that if you start pump, then sit in a loop waiting for it to stop then your code blocks - doesn't do anything else. Running with the variables you can do multiple things at once so you can add more if statements and another pump variable to managed your second pump. If there is logic between the two pumps I'm not getting then you can add that within the if statements by using and/or logic, to say stop both pumps running at once or whatever this application is.
https://www.arduino.cc/en/Reference/Boolean
As I stated above all this code does is execute the logic, there would be a lot more design to making a physical thing.
If you are new to this really suggest doing a mock up of this in the desktop programing environment of your choice, since basic program structure and logic is much easier to learn when you can see it.