First of all, I never learn any java or C programming.. so I am new to any programming.

I got an assignment with skeleton provided from professor, but there are errors and I do not know how to fix it.

It is really easy to you guys.. right?

I want to finish this assignment so that I can focus on my other classes..

i will also post what I wrote in #2:D

Thanks for helping me...:o

He gave us simple instruction, input and desire output which are the following:

From Prof. :This assignment will give you practice with if statements, strings, polynomials of degree 2 and Math.sqrt.

The file available on the Web page is the main(). I have written some of it and you must complete it. The sections to be

completed are marked // Complete.

I will run your program using the input file posted on the Web page. Your output must match the desired output posted on the Web page. Be sure to test the following values:

a < -1, a == -1, a = 1, a > 1, b < -1, b == -1, b == 0, b == 1, b > 1

c < -1, c == -1, c == 0, c == 1, c > 1.

Input:

Code:`8`

-2 -2 -2 1

-1 -1 -1 2

1 -1 -1 1

1 0 0 -1

1 1 1 -2

2 2 2 1

1 0 -4 0

1 0 -25 1

Skeleton:

Code:`/**`

*

*/

package cecs174;

import java.io.File;

import java.util.Scanner;

import java.io.FileNotFoundException;

/**

* @author murgolo

*

*/

public class AssignmentFourMain

{

static final String FNAME = "ass4_input.txt";

/**

* @param args

*/

public static void main(String[] args)

{

Scanner inFile = null;

try

{

inFile = new Scanner(new File(FNAME));

}

catch(FileNotFoundException e)

{

System.out.println("Error: " + e.getMessage());

System.out.println("Make sure " + FNAME + " is in the project's top level directory");

System.exit(1);

}

int count = inFile.nextInt();

double checkSum = 0;

for(int ii = 0; ii < count; ++ii)

{

int a = inFile.nextInt();

int b = inFile.nextInt();

int c = inFile.nextInt();

int x = inFile.nextInt();

String poly = "";

// COMPLETE

System.out.println("Polynomial is " + poly);

int discriminate ;

// COMPLETE

System.out.println("The discriminate is " + discriminate);

int numRealRoots = 0, numImagRoots = 0;

double root1 = 0.0, root2 = 0.0;

// COMPLETE

System.out.println("Number of real roots = " + numRealRoots);

System.out.println("Number of imaginary roots = " + numImagRoots);

System.out.print("Equation " + poly + " = 0 has ");

// COMPLETE

System.out.println("The value of " + poly + " at " + x + " is: "); // COMPLETE

checkSum += root1 + root2;

}

System.out.println("Check sum is " + checkSum);

inFile.close();

System.exit(0);

}

}

Desire output

(a,b,c,x) = (-2,-2,-2,1)

Polynomial is -2x^2 - 2x - 2

The discriminate is -12

Number of real roots = 0

Number of imaginary roots = 2

Equation -2x^2 - 2x - 2 = 0 has no real roots

The value of -2x^2 - 2x - 2 at 1 is: -6

(a,b,c,x) = (-1,-1,-1,2)

Polynomial is -x^2 - x - 1

The discriminate is -3

Number of real roots = 0

Number of imaginary roots = 2

Equation -x^2 - x - 1 = 0 has no real roots

The value of -x^2 - x - 1 at 2 is: -7

(a,b,c,x) = (1,-1,-1,1)

Polynomial is x^2 - x - 1

The discriminate is 5

Number of real roots = 2

Number of imaginary roots = 0

Equation x^2 - x - 1 = 0 has two real roots = (1.618033988749895,-0.6180339887498949)

The value of x^2 - x - 1 at 1 is: -1

(a,b,c,x) = (1,0,0,-1)

Polynomial is x^2

The discriminate is 0

Number of real roots = 1

Number of imaginary roots = 0

Equation x^2 = 0 has one real root = 0.0

The value of x^2 at -1 is: 1

(a,b,c,x) = (1,1,1,-2)

Polynomial is x^2 + x + 1

The discriminate is -3

Number of real roots = 0

Number of imaginary roots = 2

Equation x^2 + x + 1 = 0 has no real roots

The value of x^2 + x + 1 at -2 is: 3

(a,b,c,x) = (2,2,2,1)

Polynomial is 2x^2 + 2x + 2

The discriminate is -12

Number of real roots = 0

Number of imaginary roots = 2

Equation 2x^2 + 2x + 2 = 0 has no real roots

The value of 2x^2 + 2x + 2 at 1 is: 6

(a,b,c,x) = (1,0,-4,0)

Polynomial is x^2 - 4

The discriminate is 16

Number of real roots = 2

Number of imaginary roots = 0

Equation x^2 - 4 = 0 has two real roots = (2.0,-2.0)

The value of x^2 - 4 at 0 is: -4

(a,b,c,x) = (1,0,-25,1)

Polynomial is x^2 - 25

The discriminate is 100

Number of real roots = 2

Number of imaginary roots = 0

Equation x^2 - 25 = 0 has two real roots = (5.0,-5.0)

The value of x^2 - 25 at 1 is: -24

Check sum is 1.0