Answered step by step
Verified Expert Solution
Link Copied!

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. image text in transcribed

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 roots

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

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

More Books

Students also viewed these Databases questions