/**
 * CS1101 Take-home Lab #3, Exercise 2: Bisection.java
 * 
 * This program implements the Bisection Method in numerical anaylsis.
 * To find a root of the polynomial function p(x) = 0 in interval [a,b]. 
 * Assume that p(x) is continuous and p(a) and p(b) have opposite signs.
 * 
 * Discussion group: <fill in your group number here>
 */

// add appropriate import statement(s)

class Bisection {
  
   /************************************************
    * Returns the value of the polynomial 
    *    p(x) = c3*x^3 + c2*x^2 + c1*x + c0
    ************************************************/
   // fill in the function

   /************************************************
    * main method
    ************************************************/
   public static void main (String [] arg) {

       // fill in missing code

       System.out.print("Enter coefficients (c3,c2,c1,c0) of polynomial: ");
       int c3 = scanner.nextInt();
       int c2 = scanner.nextInt();
       int c1 = scanner.nextInt();
       int c0 = scanner.nextInt();

       System.out.print("Enter endpoints a and b: ");
       double a = scanner.nextDouble();
       double b = scanner.nextDouble();

       double pA = polynomial(a, c3, c2, c1, c0);
       double pB = polynomial(b, c3, c2, c1, c0);

       // fill in missing code


       // print results -- complete the 2 statements below
       System.out.println("root = ");
       System.out.println("p(root) = ");
   }
}

