Re: Cannot find Symbol Error
Hi,
Please use code tags for code.
You can save what bus() function returns into a variable to be passed to vans() function as an argument.
Code:
int busValue = bus(151);
int vansValue = vans(busValue);
You also have a mistake in vans() functions, where you are using an undeclared bus variable. I guess what you want is:
Code:
public static int vans(int vans){
int rem = vans % 45;
if (rem % 45== 0)
return (0);
else
return ((rem/16)+1);
}
Regards,
Albert.
Re: Cannot find Symbol Error
To add a little to Albert's, it is generally considered bad practice to name your variables and methods the same. It can cause confusion when reading the code (yes, I know: methods have the parens, but still).
Re: Cannot find Symbol Error
Code:
int rem = vans % 45;
if (rem % 45== 0)
What is the point of using the remainder operator in the if statement. 'rem' already holds the remainder of the division of vans (which as ProgramThis has already stated is a poor name) by 45. Therefore it is going to be a number between 0 and 44 inclusive and so applying the remainder operator again is going to have no effect.