Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that uses the quadratic formula to solve quadratic equations. Background Given the format for a quadratic equations: aX 2 + bX +

Write a program that uses the quadratic formula to solve quadratic equations.

Background

Given the format for a quadratic equations: aX2 + bX + c = 0

The coefficient of the X2 term is the number a. The coefficient of the X term is the number b. The value of c is any non-zero constant. These values can be positive, negative or zero.

You can find the solution to this equation by using the quadratic formula. That formula is as follows:

X1 = -1 * b + (b2 4 * a * c) and X2 = -1*b - (b2 4 * a * c) means take the square root of

2*a 2*a

The expression, b2 4 * a * c, is called the discriminant and can be calculated. If the discriminant is a positive value there are 2 answers to the problem, X1 and X2, . If the discriminant is a zero, there is only 1 answer to the problem called a repeated root. If the discriminant is negative, the answer to the problem is a complex number.

Write a program that prompts the user to enter the values of a, b, and c for any quadratic equation. It then classifies the answer as a complex number, 2 different numbers, or a repeated root. It displays the answer to the problem using the correct format, (two numbers if the discriminant is positive, one number if the discriminant is zero and the phrase Complex Number if the discriminant is zero.

To square a value like b, type it into the program as: b*b

To take the square root of the discriminant use the math function: sqrt(b*b 4*a*c)

The output screen at the end of the session will look something like the following:

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago