Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use Python Programming. Design a class named Quadratic Equation for a quadratic equation ax + bx+c 0. The class contains: The data fields a, b,
Use Python Programming.
Design a class named Quadratic Equation for a quadratic equation ax + bx+c 0. The class contains: The data fields a, b, and c that represent three coefficients. . An initializer for the arguments for a, b, and c. Three getter methods for a, b, and c. A method named get Discriminant() that returns the discriminant, which is b- 4ac The methods named getRoot 1() and getRoot 2() for returning the two roots of the equation using these formulas: r1 ----7-400 and r2 --b* V62-4ac These methods are useful only if the discriminant is nonnegative. Let these methods return None if the discriminant is negative. Write a test program that prompts the user to enter values for a, b, and c and displays the result based on the discriminant. If the discriminant is positive, display the two roots. If the discriminant is o, display the one root. Otherwise, display "The equation has no rootsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started