You are over complicating things...
here is an algebraic tip... You can find any root by raising it to a power of a fraction. The denominator is the root and the numerator is the power the resultant root is raised by afterwards... some examples...
9^1/2 = 3
27^2/3 => 3^2 => 9
so something like this (pseudo code that will almost work as is)
I realize that is insanely giving the answer, but you need to go and look up how to code it correctly, AND research the theory behind it as you prof will probably ask where you got this idea from. Good luck, and thank you for posting the work you've tried on your own Homework questions are always welcome provided you put forth effort so imo you did well :P
private double findRoot(int number, int numerator, int denominator)