Question: please help! thank you! Write a program that asks for and accepts three doubles: a, b and c from the second order equation ar 2

 please help! thank you! Write a program that asks for and

accepts three doubles: a, b and c from the second order equation

please help! thank you!

Write a program that asks for and accepts three doubles: a, b and c from the second order equation ar 2 + bx + c = 0 . The program will ask for the roots and evaluate the equation. If the evaluation is 0 then you print the solution is perfect, if the evaluation is less than 0.1 then print the solution is acceptable otherwise print the solution is not acceptable. Write a program that does the following: 1) Read coefficients of second order polynomial and print equation to the screen. Enter a: 1 Enter b: -1 Enter c: -12 f(x)-x2 x 12 Note the following: if a is 1 then print x 2 instead of 1x2 if a is -1 then print-x2 instead of -1x 2 if b is 1 then print + x instead of+ 1x if b is-1 then print- x instead of +-1 x if b is negative such as -2.34 then print 2.34x instead of+ -2.34x if c is negative such as -1.98 then print 1.98 instead of + -1.98 2) Declare variable root_ type as an integer. Use the following prompt to ask the user for the root type. Print to the screen as below. Enter root type (1-distinct roots) (2-repeated roots) (3 root_type-1 -complex roots): 1 3) If root_type is 1 then ask the user for two roots. Evaluate the quadratic equation for the given roots. Print proper message to indicate how close the evaluation is to 0. Here a-1, b--1 c--12. Enter rot 1 : 4 Enter root 2: -3.01 root 1 = 4 root 2 = 3.01 Solution for root 1 -0 Solution is perfect for root 1 Solution for root 2 0.0701 Solution is acceptable for root 2 4) If root_type is 2 then ask the user for the repeated root. Evaluate the quadratic equation for the given root. Print proper message to indicate how close the evaluation is to 0. Here a-1, b-5, c 4 Enter repeated root: 2 root 1 2 root 2 2 Solution for repeated root 2 Solution is not acceptable for the repeated root 4) If root_type is 3 then ask the user for the complex roots. Evaluate the quadratic equation for the given roots. Print proper message to indicate how close the evaluation is to 0. Here a-2, b-3, c=4. Equations will be given in the class on how to evaluate the complex roots. Enter real part of root 1: -0.75 Enter imaginary part of root 1: 1.199 root =-0.75 + j1.199 root 20.75 j1.199 Solution for root 1 0.000202 Solution is acceptable for root 1 Solution for root 2 0.00020:2 Solution is acceptable for root 2 j1.199 instead of+ j-1.199 if imaginary part is negative such as -1.199 then print

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!