Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that prompts the user to input the value of a (the coefficient o

ID: 3527606 • Letter: W

Question

Write a program that prompts the user to input the value of a (the coefficient of x 2 ), b (the coefficient of x), and c (the constant term), and outputs the type of roots of the equation. Furthermore, if b 2 4ac 0, the program should output the roots of the quadratic equation.

I need the program to prompt up in a cmdwindow andask for

"The coefficent of x square"

"The coefficent of X"

"constant term"

at the end of the prompt it needs to say "The equation has complex roots"

It needs to be in java!

Explanation / Answer

import java.util.*;

class test

{

public static void main(String[] args)

{

int a,b,c;

Scanner in = new Scanner(System.in);

System.out.println(" enter The coefficent of x square ");

a = in.nextInt();

System.out.println(" enter The coefficent of X ");

b = in.nextInt();

System.out.println(" enter constant term ");

c = in.nextInt();

if((b*b- 4*a*c) < 0)

System.out.println("The equation has complex roots");


}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote