This code may work, I did not define the variables outside the constructor with public or private. I'm going to try and run this code on and see if the null pointer exception is still thrown.