-----------------------------------
randint
Sat Oct 29, 2011 3:55 pm
Remainder Theorem
-----------------------------------
The remainder theorem, known as P(x)/d(x), where P(x) is any polynomial, d(x) is a linear. When you use the the root of d(x) and "plug" it into P(x), you get the remainder of the function.
-----------------------------------
Zren
Sat Oct 29, 2011 6:28 pm
RE:Remainder Theorem
-----------------------------------
You might want to consider showing which coefficient your input is for.
Eg: 'Enter coefficient n (nx^3): '
~
Also, when a user's input is incorrect, you should not be continuing.
try
{
degree = Integer.parseInt (br.readLine()) + 1;
}
catch (NumberFormatException n)
{
System.out.println ("You have not entered a valid integer!");
}
You should either loop input until a valid input has been given, or you should be exiting your logic process when it happens.
[code]
C:\Users\Admin\Desktop>java Remainder_Theorem
Enter the highest degree term: 0
Enter coefficient: a
You have not entered a valid number!
Enter the slope: a
You have not entered a valid number!
0.0x is a factor of this polynomial.
[/code]
I'll also hint that since you're getting a double as input more than once, that you should consider writing a function to getInputDouble() that'll do the looping/error catching inside of that, and would return a valid number.
-----------------------------------
randint
Sun Oct 30, 2011 1:00 pm
RE:Remainder Theorem
-----------------------------------
Yes, this is correct, in the newer version, I will add System.exit (0); in the catch blocks.