This doesn't make sense. You would see why this isn't working if you run it in a debugger and look at what is happening with each value.
percentage = (double)total/ occupiedTotal;
Why are you using int type here for all 3 variables? And why are you trying to typecast one of them?
CodingForums Supreme Overlord
All Hail Spookster