CB Scholarship help in code

please check the code and let know of the errors.
static int getPerson(int n, int m, int x){

	int ans = 0;
	if(x > m)return 0;
    if(x == m)return 1;
    else if((n*x) <= m) ans = n;
	else{
    	while((n*x) > m){
        	n--;
    	}
    	ans = n;
	}
	return ans;
}

static int getNumber(int n, int m, int x, int y){

    int ans = 0;
        while(n > 0) {
            int k = 0;
            k = getPerson(n, m, x);
            ans = ans + k;
            m = m - (k * x);
            n = n - k;
            if (n == 1) break;
            else{
                m = m + y;
                n--;
            }
        }
    return ans;
}