Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a program using c++ I just need help with the last two 4) and 4) for the second one use the equation in the

image text in transcribed

image text in transcribed

write a program using c++ I just need help with the last two 4) and 4) for the second one use the equation in the third pic.

image text in transcribed

thank you!

Write a program that asks for and accepts three doubles: a, b and c from the second order equation ax2 + 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 x2 instead of 1x2 if a is -1 then print-x 2 instead of-1x*2 if b is 1 then print+ x instead of+ 1x if b is-1 then print- x instead of +-1x 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. 11-distinct rootsi (2-repeated roots) 3-complex roots: 1 et typo root type- 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 root 1: 4 Enter root 2: -3.01 root 1 4 root 2 --3.01 Solution for root 1 0 let tor 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 1 #-0.75 + j1.199 root 2 =-0.75 - j1.199 Solution for root 1- 0.000202 Solution is acceptable for root 1 Solution for root 2-0.000202 solution is acceptable for root 2 if imaginary part is negative such as -1.199 then print j1.199 instead of+ j-1.199 AC h c n

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

d. What language(s) did they speak?

Answered: 1 week ago