you should assign wid to Width and Length to len and not the contrary! and the very last bug is the assignment int S = R.Surface ; change this to int S = R.Surface(R.Length, R.Width); i hope after this corrections you get your result 4. good luck!