0% found this document useful (0 votes)
3 views2 pages

Open Project

Uploaded by

kennekouatedzor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Open Project

Uploaded by

kennekouatedzor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Introduction
Title: A calculator of quadratic equation

Description: This program this program gets the coefficient of quadratic equation and display the real
solution of the equation. It equally displays a message “No real roots” when there is not real solution to
the equation.

2.Design
Pseudo code

1. Get a, b, c (the coefficient of the quadratic equation)


2. Compute the solution to the quadratic equation (Find the roots)
3. If the roots are real numbers
4. Then print the real number
5. Else, print “No real solution”

Description of variable, formulas and type to be used

Variable:

- a, b, and c will be used as variable to do this program. Since we need a real solution then the variable
will be an integer.

-d will be used as the discriminant so 𝑑 = 𝑏 2 − 4𝑎𝑐 and it is equally an interger

-r1 refers to root one and it is a floating number

-r2 refers to root two and it is equally a floating number

Formula: Since we need the root the following formula will be use to find the two real roots of the
equation named alpha and beta.

−𝑏 + √𝑏 2 − 4𝑎𝑐
∝=
2𝑎
−𝑏 − √𝑏 2 − 4𝑎𝑐
𝛽=
2𝑎

Test plan and variable

The following test plan was prepared to test the final program and the algorithm was dry run with the
test plan data.

Test data (a, b, c) Expected result Result after dry run


a = 1, b = 2, c = 1 ∝ = 1 𝑎𝑛𝑑 𝛽 = 1 ∝ = 1 𝑎𝑛𝑑 𝛽 = 1
a = 1, b = 2, c = 5 No real roots No real roots
3.Implementation
Programming environment: Code blocks

Steps

1. Coding
2. Compiling and correcting errors

Source Code

The syntax errors were corrected by checking the appropriate format and if any semicolon is omitted.

4.Testing
Strategy used: The output was compared with the initial design so that the result match the expected
value.

Outputs

5.Conclusion
The main difficulty was to compile and correct errors

You might also like