Assignment (4)

CS1440 – Due Friday Sept. 15

1.Write a C++ code to solve the following quadratic equations:

*y = 6x ^{2}+4x+3*

*y =-2x ^{2}+3x+12*

*y = x ^{2}+4x+24*

*y = -4x ^{2}-2x-3*

The solution to a 2^{nd}
order quadratic equation y = *ax ^{2}+bx+c is:*

_{}

In our case, *a = 6, b = 4, and c=3.*

This equation can have one of the following three solutions depending on the value of:

*b ^{2} – 4ac. *Here
are the possibilities:

* *If *b ^{2} – 4ac> 0, i.e., b^{2}
> 4ac* then we have two solutions, and

_{}

If
*b ^{2} – 4ac= 0, i.e., b^{2} = 4ac *then we have only one
solution, and

_{}

If
*b ^{2} – 4ac< 0, i.e., b^{2} < 4ac *then there is no
real solution.

(Actually, there are two imaginary solutions, but for now we assume no solution)

Your algorithm must consider all these details and be able to solve all possible cases and print a warning for cases that is unable to solve.

Sample in put:

This program solves the quadratic equation:

Enter a:

?

Enter b:

?

Enter c:

For this case, a = ?, b = ?, c = ?, solution(s) are:

????????

next case

…

..