Welcome to CodeRanch!
That's an absolutely terribly written application. I hope you didn't pay money for the training program that produced that code.
Anyway, if you can't rely on libraries to do the heavy lifting for you, you must implement an iterative root finding algorithm. Look at the pointers here:
https://en.wikipedia.org/wiki/Root-finding_algorithms#Roots_of_polynomials
Once you understand the algorithm, you can write it down in absolutely any programming language. If you need help on specific parts, tell us what you're stuck on.