You are required to write a code that requests the user to enter three integer coefficients: a, b, and c in this order. Next, the user is requested to enter the equation degree: 1 for a linear equation and 2 for a quadratic equation. If the user enters an equation degree other than 1 or 2, the program must output Invalid. Based on the equation type, the program will process the coefficients and provide outputs as described below: First Scenario: Linear Equation When a linear equation is selected, the coefficient a is ignored and the equation format becomes: y=bx+c The program should check the slope of the line and accordingly print the values of the x-intercept, the y-intercept, and the line direction with respect to the x-axis each on a separate line. We have four possibilities: Slope is positive (i.e. b > 0): x-intercept = −cb, y-intercept = c, direction is Upward Slope is negative (i.e. b < 0): x-intercept = −cb, y-intercept = c, direction is Downward Slope is zero (i.e. b = 0) and (c = 0): x-intercept = All, y-intercept = 0, direction is Parallel Slope is zero (i.e. b = 0) and (c ≠ 0): x-intercept = None, y-intercept = c, direction is Parallel Second Scenario: Quadratic Equation When a quadratic equation is selected, the equation format is: y=ax2+bx+c The program should check the value of coefficient a then check if the equation has real roots and accordingly print the real roots values and the Parabola opening direction each on a separate line: if (a = 0): handle it as a Linear equation as described above if (a ≠ 0): (b2>=4ac): root1 = −b+b2−4ac√2a and root2 = −b−b2−4ac√2a (b2<4ac): real roots = None (a > 0): Parabola opening direction is Top (a < 0): Parabola opening direction is Bottom
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
You are required to write a code that requests the user to enter three integer coefficients: a, b, and c in this order. Next, the user is requested to enter the equation degree: 1 for a linear equation and 2 for a quadratic equation. If the user enters an equation degree other than 1 or 2, the
First Scenario: Linear Equation
When a linear equation is selected, the coefficient a is ignored and the equation format becomes:
y=bx+c
The program should check the slope of the line and accordingly print the values of the x-intercept, the y-intercept, and the line direction with respect to the x-axis each on a separate line. We have four possibilities:
Slope is positive (i.e. b > 0): x-intercept = −cb, y-intercept = c, direction is Upward
Slope is negative (i.e. b < 0): x-intercept = −cb, y-intercept = c, direction is Downward
Slope is zero (i.e. b = 0) and (c = 0): x-intercept = All, y-intercept = 0, direction is Parallel
Slope is zero (i.e. b = 0) and (c ≠ 0): x-intercept = None, y-intercept = c, direction is Parallel
Second Scenario: Quadratic Equation
When a quadratic equation is selected, the equation format is:
y=ax2+bx+c
The program should check the value of coefficient a then check if the equation has real roots and accordingly print the real roots values and the Parabola opening direction each on a separate line:
if (a = 0): handle it as a Linear equation as described above
if (a ≠ 0):
(b2>=4ac): root1 = −b+b2−4ac√2a and root2 = −b−b2−4ac√2a
(b2<4ac): real roots = None
(a > 0): Parabola opening direction is Top
(a < 0): Parabola opening direction is Bottom
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 8 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)