Jesus Rod Valenzuela

Greenhorn

Posts: 9

posted 1 year ago

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

this is what i got. please help!!

[HENRY: fixed code tags]

this is what i got. please help!!

[HENRY: fixed code tags]

Norm Radder

Ranch Foreman

Posts: 2240

28

posted 1 year ago

Please explain what the problem is. Post the current output and add some comments saying what is wrong with it.

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.

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

Norm Radder

Ranch Foreman

Posts: 2240

28

Jesus Rod Valenzuela

Greenhorn

Posts: 9

posted 1 year ago

Enter the coefficient of the quadratic term -> 9

Enter the coefficient of the linear term -> 0

Enter the constant term -> 16

For the quadratic equation 9.00000x^2+16.00000=0

Enter the coefficient of the quadratic term -> 9

Enter the coefficient of the linear term -> 16

Enter the constant term -> 0

For the quadratic equation 9.00000x^2+16.00000x=0

something like that

Enter the coefficient of the linear term -> 0

Enter the constant term -> 16

For the quadratic equation 9.00000x^2+16.00000=0

Enter the coefficient of the quadratic term -> 9

Enter the coefficient of the linear term -> 16

Enter the constant term -> 0

For the quadratic equation 9.00000x^2+16.00000x=0

something like that

Norm Radder

Ranch Foreman

Posts: 2240

28

Campbell Ritchie

Marshal

Posts: 55681

161

posted 1 year ago

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.

Avoid ^2; use

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.

Avoid ^2; use

__\u00b2__inside your Strings instead.