This code is from 9 years ago, there are no solutions to this problem to this date in 2024.
This package is provided by universities to teach a race condition and the problem needs to be solved using locks.
Using atomic variables is not acceptable by professors.
I am also having the same exact problem. I cannot find the source of this package however the code is has credits as follows.
/**
public class BankSimMain ..... snip
Someone please help where we can use locks and semaphores to fix this code.