programming forums Java Java JSRs Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Products This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Sheriffs:
Saloon Keepers:
Bartenders:

Greenhorn
Posts: 9
Hello, I'm having troubles trying to display a quadratic solver that uses nested if statements to determine how the equation should be printed.

[HENRY: fixed code tags]

Rancher
Posts: 2745
31
Please explain what the problem is.  Post the current output and add some comments saying what is wrong with it.

uses nested if statements

The code is missing all the nested if statements' indentations.  Please update the code and fix the indentations to make the code easier to read and understand.

Jesus Rod Valenzuela
Greenhorn
Posts: 9
I need the program to change the quadratic term when it is 1 to just x^2, and do the same when the linear term is 1 juts x

Rancher
Posts: 2745
31
Show what you want the output to look like.

Jesus Rod Valenzuela
Greenhorn
Posts: 9
Enter the  coefficient of the  quadratic term -> 9

Enter the  coefficient of the  linear  term -> 0

Enter the  constant  term -> 16

Enter the  coefficient of the  quadratic term -> 9

Enter the  coefficient of the  linear  term -> 16

Enter the  constant  term -> 0

something like that

Rancher
Posts: 2745
31
If that is the program's current output, please add some comments showing where it is wrong and show what it should be.
For example:
For the  quadratic equation  9.00000x^2+16.00000x=0  <<<*** wrong
The output should be: For the  quadratic equation  9.0x^2+16.0x=77

Marshal
Posts: 57437
175
Welcome to the Ranch

Your main method is much too long and is trying to do too many things. Create methods for input and check that they are working. Create a method for solving the equations and check that they are working, separately. But before you do that, write down in very simple words how you are going to solve the equations, because those instructions will be easy to turn into code.