Question: Please show input and output code clearly! Thank you! Program 5- Roots (homework) CSCI 251 The two roots of a quadratic equation ax2 + bx

Please show input and output code clearly! Thank you!

Please show input and output code clearly! Thank you! Program 5- Roots

(homework) CSCI 251 The two roots of a quadratic equation ax2 +

Program 5- Roots (homework) CSCI 251 The two roots of a quadratic equation ax2 + bx +c can be obtained using the following formula: and r2 2a b2-4ac is called the discriminant of the quadratic equation, and its value determines the mumber of roots as follows: b2-4ac>0, tworeal roots:l and r2 b2-4ac 0, one real root: r b2-4ac 0, no real roots Write a function called roots yourLastName that takes in 3 arguments- coefficient a, coefficient b, and coefficient c, and the return value for the function expects one of three values as shown below: 0: no roots 1: one root 2: two roots b'-4ac

    0 within the function, determine the number of roots and return the corresponding number [O1, or 2). Also write how this function would be called in your main program rootsTest yourLastName.m In the main program, prompt the user for coefficients a, b, and c. Based on the number of roots, determine and output the root values, if there are any (you must use an if-statement for this You need to submit two files for this program, roots yourLastName.m and rootsTest yourLastName.m Include header comments formatted exactly as shown below but with your name, student ID, and section numbre., these comments should be the FIRST LINES in your script). Be sure to include the Honor Code statement. Your electronic submission of the program file will represent your endorsement of the Honor Code Statement. % Course: CSCI 251, Section X % Student Name:ane Doe % Student ID: 12345678 % Program 5 homework % Due Date: % In keeping with the Honor Code of UM, I have neither % given nor received assistance from anyone other than the instructor. Description: Before each significant step, provide a comment explaining the step (do not comment every line of code)

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!