Earning money gets way faster than paying off the debt. This way, when you get more than 32,767 cash, the counter overflows and the amount of money becomes negative. You shouldn't use a short (16 bit variable) for the money, instead a long (32 bit) can help to avoid this problem.