0
Code for polynomial equation?
4 odpowiedzi
+ 1
One of your problems is you need an endquote on line 39 to enclose the string in the print statement
0
There are some mistakes in variable names and in the method declaration - you put ";" and in string which you print. Look at the code 🐱
https://code.sololearn.com/cNoiSAWHS83i/?ref=app
0
import java.util.Scanner;
class polynomialEquation
{
    public static void main (String[] args)
    {
        //TODO Auto-generated method stub
        double a, b, c;
        Scanner in = new Scanner (System.in);
    
        System.out.println("Enter thw values of a b and c");
        
        a=in.nextDouble();
        b=in.nextDouble();
        c=in.nextDouble();
        
        findingRoots fr = new findingRoots();
        fr.calValue (a, b, c);
    }
}
class findingRoots
{
    void calValue (double a, double b, double c)
    {
            double dis ;
            double roots;
        
            if(a==0)
{
                System.out.println("it is not in quadratic form");
return;
}
 dis = Math.pow (b, 2.0) - 4*a*c;
 roots =Math.sqrt (Math.abs(dis));
if(dis>0)
{
    System.out.println("The roots of given quadratic equation are real and different");
    System.out.print("Values of roots: *");
    System.out.println ((double) (-b + roots) / (2*a) + (double) (-b - roots)/(2*a));
        }
else
{
0
Still not running😭😭



