Welcome to the Ranch
Don't run anything from your
IDE until all the compilation errors have been sorted. The error messages from the IDE are usually more helpful than the runtime errors.
Not being able to find
rate1 might mean you have spelt it differently; even the tiniest error will throw the compiler. If you declared it as Rate1 and try to use it as rate1, it cannot be found. By the way: rate1 with a small
r is correct.
Another possibility is that you are dealing with a local variable; if you are outwith the {} pair rate1 was declared in, it will be out of scope and inaccessible.