Why does my code give NullPointerException error?

Thanks for the help

You’re quite welcome; we are always happy to help with coding issues. Good luck with your project.