Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions: Ask the user to enter successively three coefficients for the quadratic equation, with names a, b, and c. Check this input. All coefficients must

Instructions:

Ask the user to enter successively three coefficients for the quadratic equation, with names a, b, and c.

Check this input. All coefficients must not be equals zero. If even one of the coefficients equals zero, the program should output the error message as follows - This is not a Standard Form of Quadratic Equation!

Calculate the Discriminant, according to the formula.

Analyze the value of the Discriminant.

If the Discriminant is positive, your program should calculate two roots, according to formulas, and output the appropriate message. Use the method sqrt() from Math class in roots calculation.

If the Discriminant is equaled zero, the program calculates only one root and outputs the appropriate message.

If the Discriminant is negative, it means, there are no roots, the program should only output the message.

Dont forget about comments.

1. Input: a=1, b=-12, c=36

Output: The Quadratic Equation has one root because the Discriminant is equaled zero.

2. Input: a=1, b=7, c=12

Output: The Quadratic Equation has two roots.

x1=-3.0 and x2=-4.0

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 Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

Compute the derivative f(x)=(x-a)(x-b)

Answered: 1 week ago