Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Pyhton By first executing your code you should obtain the following: Welcome to Quadratic Solver for f(x)-ax**2+bx+c Enter value for a: 2 Enter value for

Pyhton

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

By first executing your code you should obtain the following: Welcome to Quadratic Solver for f(x)-ax**2+bx+c Enter value for a: 2 Enter value for b: 3 Enter value for c: 1 Equation is: f(x)-2.0x* 2+3.0x+1.0 Press Enter to continue. . . By order, (1) the code is printing the welcome statement "Welcome to Quadratic Solver for f(x)-ax**2+bx+c" (2) it is then skipping a line, (3) ask the user to enter a value for a, for b and for c (we use 2, 3, 1, respectively, for this example), (4) skip a line again, (5) return the expression of the quadratic function f (x), (6) skip a line, (7) wait for the user to press Enter/Return before to process further What you need to implement 1. A function my quad equation that should accept a,b,c and should display or return the equation (String). The input coefficients a,b,c are considered float and could be converted to string before display 2. the Press Enter to continue... wait instruction (including 'line skipping'), could simply be achieved by adding this line to the program temp input (" Press Enter to continue ") # wait where temp is just a temporary unused variable Task-2- [15pts] Let us continue with the execution of the program: Welcome to Quadratic Solver for f(x)-ax**2+bx+c Enter value for a: 2 Enter value for b: 3 Enter value forc:1 Equation is: f (x)-2.0x**2+3.0x+1.0 Press Enter to continue... Enter value for x: 3 f (3.0)- 28.0 Press Enter to continue... The program is then asking the user to enter a value x (we choose 3 here), and it will return the value of the quadratic function for this specific x (i.e. f(x)). We then skip a line and wait again for the user to press Enter/Return before to process further. What you need to implement: 1. a new function evaluate quad equation that should accept the coefficients a,b,c and the variable x as arguments and return the value of f(x). Task-4-[20pts] Let us continue with the execution. Welcome to Quadratic Solver for f(x)-ax* *2+bx+c Enter value for a 2 Enter value for b: 3 Enter value for c: 1 Equation is: f(x)-2.0x**2+3.0x+1.0 Press Enter to continue. .. Enter value for x: 3.0 f (3.0)-28.0 Press Enter to continue. .. f (x) has a minimum at x0--0.75 with value f (x0)-0.125 Press Enter to continue. .. Solving for f(x)-0 Discriminant is 1.0 Two real solutions: -0.5 and -1.0 Thanks for using Quadratic solver!, come back soon After this execution, the program must end by skipping a line and displaying Thanks for using Quadratic solver!, come back soon By steps, the program must: (1) simply display what this execution is doing, mainly solving for f(x) = 0, (2) compute and display the discriminant (value of d = b2-4ac), (3) return the values of the solutions. If d > 0 like in this case, the program wil1 return two real solutions -b-Vd , and r2- 0 If d = 0 the program should return only one real solution Zo =-b/(2a) (which happened to be the extremum already calculated in Task-3). If you choose the inputs a-1, b-2, c-1, the output (at this stage of the execution) should look like Press Enter to continue. Solving for f(x)-0 Discriminant is 0.0 One real solution: -1.0 Thanks for using Quadratic solver!, come back soon If d 0.0 and d

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

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

Students also viewed these Databases questions

Question

=+ What topics should be provided in training programs?

Answered: 1 week ago